Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public partial class Startup
  2. {
  3. public void ConfigureAuth(IAppBuilder app)
  4. {
  5. app.UseCookieAuthentication(new CookieAuthenticationOptions
  6. {
  7. AuthenticationType = "Cookies"
  8. });
  9.  
  10. app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
  11. {
  12. Authority = ConfigurationManager.AppSettings["id:Authority"],
  13. Scope = "openid profile",
  14. ClientId = ConfigurationManager.AppSettings["id:ClientId"],
  15. RedirectUri = ConfigurationManager.AppSettings["id:RedirectUri"],
  16. ResponseType = "id_token",
  17. SignInAsAuthenticationType = "Cookies",
  18. });
  19.  
  20. app.UseStageMarker(PipelineStage.Authenticate);
  21. }
  22.  
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. // Send an OpenID Connect sign-in request.
  26. if (!System.Web.HttpContext.Current.Request.IsAuthenticated)
  27. {
  28. HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement