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