Switch to new Auth API (#1296)
This commit is contained in:
parent
661f6d5103
commit
ef411276d6
|
|
@ -21,10 +21,9 @@ namespace Microsoft.AspNetCore.Authentication.Extensions
|
|||
sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
sharedOptions.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
|
||||
});
|
||||
|
||||
services.AddOpenIdConnectAuthentication();
|
||||
services.AddCookieAuthentication();
|
||||
})
|
||||
.AddOpenIdConnect()
|
||||
.AddCookie();
|
||||
return services;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
services.AddTransient<IConfigureOptions<IdentityServiceOptions>, IdentityServiceOptionsDefaultSetup>();
|
||||
services.AddTransient<IConfigureOptions<IdentityServiceOptions>, IdentityServiceOptionsSetup>();
|
||||
|
||||
services.AddCookieAuthentication(IdentityServiceOptions.CookieAuthenticationScheme, options =>
|
||||
services.AddAuthentication().AddCookie(IdentityServiceOptions.CookieAuthenticationScheme, options =>
|
||||
{
|
||||
options.CookieHttpOnly = true;
|
||||
options.CookieSecure = CookieSecurePolicy.Always;
|
||||
|
|
|
|||
|
|
@ -63,32 +63,25 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
where TRole : class
|
||||
{
|
||||
// Services used by identity
|
||||
services.AddAuthenticationCore(options =>
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = IdentityConstants.ApplicationScheme;
|
||||
options.DefaultChallengeScheme = IdentityConstants.ApplicationScheme;
|
||||
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
|
||||
});
|
||||
|
||||
services.AddCookieAuthentication(IdentityConstants.ApplicationScheme, o =>
|
||||
}).AddCookie(IdentityConstants.ApplicationScheme, o =>
|
||||
{
|
||||
o.LoginPath = new PathString("/Account/Login");
|
||||
o.Events = new CookieAuthenticationEvents
|
||||
{
|
||||
OnValidatePrincipal = SecurityStampValidator.ValidatePrincipalAsync
|
||||
};
|
||||
});
|
||||
|
||||
services.AddCookieAuthentication(IdentityConstants.ExternalScheme, o =>
|
||||
}).AddCookie(IdentityConstants.ExternalScheme, o =>
|
||||
{
|
||||
o.CookieName = IdentityConstants.ExternalScheme;
|
||||
o.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
||||
});
|
||||
|
||||
services.AddCookieAuthentication(IdentityConstants.TwoFactorRememberMeScheme,
|
||||
o => o.CookieName = IdentityConstants.TwoFactorRememberMeScheme);
|
||||
|
||||
services.AddCookieAuthentication(IdentityConstants.TwoFactorUserIdScheme, o =>
|
||||
}).AddCookie(IdentityConstants.TwoFactorRememberMeScheme,
|
||||
o => o.CookieName = IdentityConstants.TwoFactorRememberMeScheme)
|
||||
.AddCookie(IdentityConstants.TwoFactorUserIdScheme, o =>
|
||||
{
|
||||
o.CookieName = IdentityConstants.TwoFactorUserIdScheme;
|
||||
o.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
||||
|
|
|
|||
Loading…
Reference in New Issue