简体   繁体   中英

Redirect to external authentication provider without button click using OWIN

BACKGROUND: My company recently set up an Identity Provider (IdP). I am using the Kentor AuthServices library, OWIN, and ASP.NET Identity to allow users to log into a web site through this IdP. This works.

Right now a user requests a page on our site, and they are redirected to the login page where there is a button to log in through our IdP. They click it, log in, and are redirected back. This is like a standard VS2015 ASP.NET Web Application project with external (eg, Twitter, Facebook) authentication providers - just with some custom code in /App_Start/Startup.Auth.cs for my company's IdP.

Since we only offer one login provider, and the entire site requires login (except the login page), I'd like to simply redirect users to our IdP without the intermediate login page and manual button click. Is there a method I can call or a POST/redirect I can make programmatically to mimic what happens when a user clicks the login button?

Unfortunately I am new to OWIN and ASP.NET Identity.

  • Google is failing me
  • Debugging and breakpoints aren't catching how the redirect to the provider works

它应该像用硬编码的HttpContext.GetOwinContext()。Authentication.Challenge(“ MyIdp‌AuthType”)替换显示登录按钮的登录控制器一样简单。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM