React to API changes in CookieAuthenticationOptions
This commit is contained in:
parent
6cdcff9b5c
commit
d4abd5499a
|
|
@ -55,20 +55,20 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
|
||||
services.AddAuthentication().AddCookie(IdentityServiceOptions.CookieAuthenticationScheme, options =>
|
||||
{
|
||||
options.CookieHttpOnly = true;
|
||||
options.CookieSecure = CookieSecurePolicy.Always;
|
||||
options.CookiePath = "/tfp/IdentityService/signinsignup";
|
||||
options.CookieName = IdentityServiceOptions.AuthenticationCookieName;
|
||||
options.Cookie.HttpOnly = true;
|
||||
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
|
||||
options.Cookie.Path = "/tfp/IdentityService/signinsignup";
|
||||
options.Cookie.Name = IdentityServiceOptions.AuthenticationCookieName;
|
||||
});
|
||||
services.ConfigureApplicationCookie(options =>
|
||||
{
|
||||
options.LoginPath = $"/tfp/IdentityService/Account/Login";
|
||||
options.AccessDeniedPath = $"/tfp/IdentityService/Account/Denied";
|
||||
options.CookiePath = $"/tfp/IdentityService";
|
||||
options.Cookie.Path = $"/tfp/IdentityService";
|
||||
});
|
||||
services.ConfigureApplicationCookie(options => options.CookiePath = $"/tfp/IdentityService");
|
||||
services.Configure<CookieAuthenticationOptions>(IdentityConstants.TwoFactorRememberMeScheme, options => options.CookiePath = $"/tfp/IdentityService");
|
||||
services.Configure<CookieAuthenticationOptions>(IdentityConstants.TwoFactorUserIdScheme, options => options.CookiePath = $"/tfp/IdentityService");
|
||||
services.ConfigureApplicationCookie(options => options.Cookie.Path = $"/tfp/IdentityService");
|
||||
services.Configure<CookieAuthenticationOptions>(IdentityConstants.TwoFactorRememberMeScheme, options => options.Cookie.Path = $"/tfp/IdentityService");
|
||||
services.Configure<CookieAuthenticationOptions>(IdentityConstants.TwoFactorUserIdScheme, options => options.Cookie.Path = $"/tfp/IdentityService");
|
||||
|
||||
services.AddTransient<IConfigureOptions<AuthorizationOptions>, IdentityServiceAuthorizationOptionsSetup>();
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
var clientId = application.FindFirstValue(IdentityServiceClaimTypes.ClientId);
|
||||
var logoutUris = application.FindAll(IdentityServiceClaimTypes.LogoutRedirectUri);
|
||||
|
||||
var duration = _sessionCookieOptions.ExpireTimeSpan;
|
||||
var duration = _sessionCookieOptions.Cookie.Expiration ?? default(TimeSpan);
|
||||
var expiration = _timeStampManager.GetTimeStampInEpochTime(duration);
|
||||
|
||||
var identity = new ClaimsIdentity(
|
||||
|
|
|
|||
|
|
@ -68,23 +68,26 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
options.DefaultAuthenticateScheme = IdentityConstants.ApplicationScheme;
|
||||
options.DefaultChallengeScheme = IdentityConstants.ApplicationScheme;
|
||||
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
|
||||
}).AddCookie(IdentityConstants.ApplicationScheme, o =>
|
||||
})
|
||||
.AddCookie(IdentityConstants.ApplicationScheme, o =>
|
||||
{
|
||||
o.LoginPath = new PathString("/Account/Login");
|
||||
o.Events = new CookieAuthenticationEvents
|
||||
{
|
||||
OnValidatePrincipal = SecurityStampValidator.ValidatePrincipalAsync
|
||||
};
|
||||
}).AddCookie(IdentityConstants.ExternalScheme, o =>
|
||||
})
|
||||
.AddCookie(IdentityConstants.ExternalScheme, o =>
|
||||
{
|
||||
o.CookieName = IdentityConstants.ExternalScheme;
|
||||
o.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
||||
}).AddCookie(IdentityConstants.TwoFactorRememberMeScheme,
|
||||
o => o.CookieName = IdentityConstants.TwoFactorRememberMeScheme)
|
||||
o.Cookie.Name = IdentityConstants.ExternalScheme;
|
||||
o.Cookie.Expiration = TimeSpan.FromMinutes(5);
|
||||
})
|
||||
.AddCookie(IdentityConstants.TwoFactorRememberMeScheme,
|
||||
o => o.Cookie.Name = IdentityConstants.TwoFactorRememberMeScheme)
|
||||
.AddCookie(IdentityConstants.TwoFactorUserIdScheme, o =>
|
||||
{
|
||||
o.CookieName = IdentityConstants.TwoFactorUserIdScheme;
|
||||
o.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
||||
o.Cookie.Name = IdentityConstants.TwoFactorUserIdScheme;
|
||||
o.Cookie.Expiration = TimeSpan.FromMinutes(5);
|
||||
});
|
||||
|
||||
// Hosting doesn't add IHttpContextAccessor by default
|
||||
|
|
@ -111,4 +114,4 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
return new IdentityBuilder(typeof(TUser), typeof(TRole), services);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Identity.InMemory
|
|||
{
|
||||
services.ConfigureApplicationCookie(options =>
|
||||
{
|
||||
options.ExpireTimeSpan = TimeSpan.FromMinutes(10);
|
||||
options.Cookie.Expiration = TimeSpan.FromMinutes(10);
|
||||
options.SlidingExpiration = false;
|
||||
});
|
||||
services.AddSingleton<ISystemClock>(clock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue