From d1ffa919087806a5e4d5ec984dec5fddcc86ae4e Mon Sep 17 00:00:00 2001 From: "Stephen Halter (from Dev Box)" Date: Thu, 17 Aug 2023 16:26:19 -0700 Subject: [PATCH] SignInManager.AuthenticationScheme rename --- .../IdentityApiEndpointRouteBuilderExtensions.cs | 2 +- src/Identity/Core/src/PublicAPI.Unshipped.txt | 4 ++-- src/Identity/Core/src/SignInManager.cs | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs b/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs index 572fa2a7ee29..ce283af73fc5 100644 --- a/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs +++ b/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs @@ -96,7 +96,7 @@ public static IEndpointConventionBuilder MapIdentityApi(this IEndpointRou var useCookieScheme = (useCookies == true) || (useSessionCookies == true); var isPersistent = (useCookies == true) && (useSessionCookies != true); - signInManager.PrimaryAuthenticationScheme = useCookieScheme ? IdentityConstants.ApplicationScheme : IdentityConstants.BearerScheme; + signInManager.AuthenticationScheme = useCookieScheme ? IdentityConstants.ApplicationScheme : IdentityConstants.BearerScheme; var result = await signInManager.PasswordSignInAsync(login.Email, login.Password, isPersistent, lockoutOnFailure: true); diff --git a/src/Identity/Core/src/PublicAPI.Unshipped.txt b/src/Identity/Core/src/PublicAPI.Unshipped.txt index 9d71c07cd782..061ed40ebeba 100644 --- a/src/Identity/Core/src/PublicAPI.Unshipped.txt +++ b/src/Identity/Core/src/PublicAPI.Unshipped.txt @@ -3,8 +3,8 @@ Microsoft.AspNetCore.Identity.SecurityStampValidator.SecurityStampValidat Microsoft.AspNetCore.Identity.SecurityStampValidator.TimeProvider.get -> System.TimeProvider! Microsoft.AspNetCore.Identity.SecurityStampValidatorOptions.TimeProvider.get -> System.TimeProvider? Microsoft.AspNetCore.Identity.SecurityStampValidatorOptions.TimeProvider.set -> void -Microsoft.AspNetCore.Identity.SignInManager.PrimaryAuthenticationScheme.get -> string! -Microsoft.AspNetCore.Identity.SignInManager.PrimaryAuthenticationScheme.set -> void +Microsoft.AspNetCore.Identity.SignInManager.AuthenticationScheme.get -> string! +Microsoft.AspNetCore.Identity.SignInManager.AuthenticationScheme.set -> void Microsoft.AspNetCore.Identity.TwoFactorSecurityStampValidator.TwoFactorSecurityStampValidator(Microsoft.Extensions.Options.IOptions! options, Microsoft.AspNetCore.Identity.SignInManager! signInManager, Microsoft.Extensions.Logging.ILoggerFactory! logger) -> void Microsoft.AspNetCore.Routing.IdentityApiEndpointRouteBuilderExtensions static Microsoft.AspNetCore.Identity.IdentityBuilderExtensions.AddApiEndpoints(this Microsoft.AspNetCore.Identity.IdentityBuilder! builder) -> Microsoft.AspNetCore.Identity.IdentityBuilder! diff --git a/src/Identity/Core/src/SignInManager.cs b/src/Identity/Core/src/SignInManager.cs index 2f561c97c3e8..b5659b329854 100644 --- a/src/Identity/Core/src/SignInManager.cs +++ b/src/Identity/Core/src/SignInManager.cs @@ -84,7 +84,7 @@ public SignInManager(UserManager userManager, /// /// The authentication scheme to sign in with. Defaults to . /// - public string PrimaryAuthenticationScheme { get; set; } = IdentityConstants.ApplicationScheme; + public string AuthenticationScheme { get; set; } = IdentityConstants.ApplicationScheme; /// /// The used. @@ -122,7 +122,7 @@ public virtual bool IsSignedIn(ClaimsPrincipal principal) { ArgumentNullException.ThrowIfNull(principal); return principal.Identities != null && - principal.Identities.Any(i => i.AuthenticationType == PrimaryAuthenticationScheme); + principal.Identities.Any(i => i.AuthenticationType == AuthenticationScheme); } /// @@ -161,7 +161,7 @@ public virtual async Task CanSignInAsync(TUser user) /// The task object representing the asynchronous operation. public virtual async Task RefreshSignInAsync(TUser user) { - var auth = await Context.AuthenticateAsync(PrimaryAuthenticationScheme); + var auth = await Context.AuthenticateAsync(AuthenticationScheme); IList claims = Array.Empty(); var authenticationMethod = auth?.Principal?.FindFirst(ClaimTypes.AuthenticationMethod); @@ -237,7 +237,7 @@ public virtual async Task SignInWithClaimsAsync(TUser user, AuthenticationProper { userPrincipal.Identities.First().AddClaim(claim); } - await Context.SignInAsync(PrimaryAuthenticationScheme, + await Context.SignInAsync(AuthenticationScheme, userPrincipal, authenticationProperties ?? new AuthenticationProperties()); @@ -250,7 +250,7 @@ await Context.SignInAsync(PrimaryAuthenticationScheme, /// public virtual async Task SignOutAsync() { - await Context.SignOutAsync(PrimaryAuthenticationScheme); + await Context.SignOutAsync(AuthenticationScheme); if (await _schemes.GetSchemeAsync(IdentityConstants.ExternalScheme) != null) { @@ -669,9 +669,9 @@ public virtual async Task ExternalLoginSignInAsync(string loginPro } /// - /// Gets a collection of s for the known external login providers. + /// Gets a collection of s for the known external login providers. /// - /// A collection of s for the known external login providers. + /// A collection of s for the known external login providers. public virtual async Task> GetExternalAuthenticationSchemesAsync() { var schemes = await _schemes.GetAllSchemesAsync();