Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Startup
- {
- public void ConfigureAuth(IAppBuilder app)
- {
- app.UseCookieAuthentication(new CookieAuthenticationOptions
- {
- AuthenticationType = "Cookies"
- });
- app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
- {
- Authority = ConfigurationManager.AppSettings["id:Authority"],
- Scope = "openid profile",
- ClientId = ConfigurationManager.AppSettings["id:ClientId"],
- RedirectUri = ConfigurationManager.AppSettings["id:RedirectUri"],
- ResponseType = "id_token",
- SignInAsAuthenticationType = "Cookies",
- });
- app.UseStageMarker(PipelineStage.Authenticate);
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- // Send an OpenID Connect sign-in request.
- if (!System.Web.HttpContext.Current.Request.IsAuthenticated)
- {
- HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement