Created
October 6, 2015 09:18
-
-
Save herskinduk/d39b23e24843ba66e5eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); | |
app.UseCookieAuthentication(new CookieAuthenticationOptions()); | |
//use OpenId | |
app.UseOpenIdConnectAuthentication( | |
new OpenIdConnectAuthenticationOptions | |
{ | |
ClientId = ..., | |
Authority = ..., | |
PostLogoutRedirectUri = "/", | |
Notifications = new OpenIdConnectAuthenticationNotifications | |
{ | |
AuthenticationFailed = context => | |
{ | |
context.HandleResponse(); | |
context.Response.Redirect("/Error?message=" + context.Exception.Message); | |
return Task.FromResult(0); | |
}, | |
SecurityTokenValidated = context => | |
{ | |
WriteTokenExipreTime(context.AuthenticationTicket.Properties.ExpiresUtc); | |
// Login with Sitecore here. | |
// Also map claims | |
return Task.FromResult(0); | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment