Skip to content

Commit cc0e232

Browse files
halter73Stephen Halter (from Dev Box)
andauthored
SignInManager.AuthenticationScheme rename (#50169)
Co-authored-by: Stephen Halter (from Dev Box) <[email protected]>
1 parent 8cb6c4e commit cc0e232

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static IEndpointConventionBuilder MapIdentityApi<TUser>(this IEndpointRou
9696

9797
var useCookieScheme = (useCookies == true) || (useSessionCookies == true);
9898
var isPersistent = (useCookies == true) && (useSessionCookies != true);
99-
signInManager.PrimaryAuthenticationScheme = useCookieScheme ? IdentityConstants.ApplicationScheme : IdentityConstants.BearerScheme;
99+
signInManager.AuthenticationScheme = useCookieScheme ? IdentityConstants.ApplicationScheme : IdentityConstants.BearerScheme;
100100

101101
var result = await signInManager.PasswordSignInAsync(login.Email, login.Password, isPersistent, lockoutOnFailure: true);
102102

src/Identity/Core/src/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Microsoft.AspNetCore.Identity.SecurityStampValidator<TUser>.SecurityStampValidat
33
Microsoft.AspNetCore.Identity.SecurityStampValidator<TUser>.TimeProvider.get -> System.TimeProvider!
44
Microsoft.AspNetCore.Identity.SecurityStampValidatorOptions.TimeProvider.get -> System.TimeProvider?
55
Microsoft.AspNetCore.Identity.SecurityStampValidatorOptions.TimeProvider.set -> void
6-
Microsoft.AspNetCore.Identity.SignInManager<TUser>.PrimaryAuthenticationScheme.get -> string!
7-
Microsoft.AspNetCore.Identity.SignInManager<TUser>.PrimaryAuthenticationScheme.set -> void
6+
Microsoft.AspNetCore.Identity.SignInManager<TUser>.AuthenticationScheme.get -> string!
7+
Microsoft.AspNetCore.Identity.SignInManager<TUser>.AuthenticationScheme.set -> void
88
Microsoft.AspNetCore.Identity.TwoFactorSecurityStampValidator<TUser>.TwoFactorSecurityStampValidator(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Identity.SecurityStampValidatorOptions!>! options, Microsoft.AspNetCore.Identity.SignInManager<TUser!>! signInManager, Microsoft.Extensions.Logging.ILoggerFactory! logger) -> void
99
Microsoft.AspNetCore.Routing.IdentityApiEndpointRouteBuilderExtensions
1010
static Microsoft.AspNetCore.Identity.IdentityBuilderExtensions.AddApiEndpoints(this Microsoft.AspNetCore.Identity.IdentityBuilder! builder) -> Microsoft.AspNetCore.Identity.IdentityBuilder!

src/Identity/Core/src/SignInManager.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public SignInManager(UserManager<TUser> userManager,
8484
/// <summary>
8585
/// The authentication scheme to sign in with. Defaults to <see cref="IdentityConstants.ApplicationScheme"/>.
8686
/// </summary>
87-
public string PrimaryAuthenticationScheme { get; set; } = IdentityConstants.ApplicationScheme;
87+
public string AuthenticationScheme { get; set; } = IdentityConstants.ApplicationScheme;
8888

8989
/// <summary>
9090
/// The <see cref="HttpContext"/> used.
@@ -122,7 +122,7 @@ public virtual bool IsSignedIn(ClaimsPrincipal principal)
122122
{
123123
ArgumentNullException.ThrowIfNull(principal);
124124
return principal.Identities != null &&
125-
principal.Identities.Any(i => i.AuthenticationType == PrimaryAuthenticationScheme);
125+
principal.Identities.Any(i => i.AuthenticationType == AuthenticationScheme);
126126
}
127127

128128
/// <summary>
@@ -161,7 +161,7 @@ public virtual async Task<bool> CanSignInAsync(TUser user)
161161
/// <returns>The task object representing the asynchronous operation.</returns>
162162
public virtual async Task RefreshSignInAsync(TUser user)
163163
{
164-
var auth = await Context.AuthenticateAsync(PrimaryAuthenticationScheme);
164+
var auth = await Context.AuthenticateAsync(AuthenticationScheme);
165165
IList<Claim> claims = Array.Empty<Claim>();
166166

167167
var authenticationMethod = auth?.Principal?.FindFirst(ClaimTypes.AuthenticationMethod);
@@ -237,7 +237,7 @@ public virtual async Task SignInWithClaimsAsync(TUser user, AuthenticationProper
237237
{
238238
userPrincipal.Identities.First().AddClaim(claim);
239239
}
240-
await Context.SignInAsync(PrimaryAuthenticationScheme,
240+
await Context.SignInAsync(AuthenticationScheme,
241241
userPrincipal,
242242
authenticationProperties ?? new AuthenticationProperties());
243243

@@ -250,7 +250,7 @@ await Context.SignInAsync(PrimaryAuthenticationScheme,
250250
/// </summary>
251251
public virtual async Task SignOutAsync()
252252
{
253-
await Context.SignOutAsync(PrimaryAuthenticationScheme);
253+
await Context.SignOutAsync(AuthenticationScheme);
254254

255255
if (await _schemes.GetSchemeAsync(IdentityConstants.ExternalScheme) != null)
256256
{
@@ -669,9 +669,9 @@ public virtual async Task<SignInResult> ExternalLoginSignInAsync(string loginPro
669669
}
670670

671671
/// <summary>
672-
/// Gets a collection of <see cref="AuthenticationScheme"/>s for the known external login providers.
672+
/// Gets a collection of <see cref="Authentication.AuthenticationScheme"/>s for the known external login providers.
673673
/// </summary>
674-
/// <returns>A collection of <see cref="AuthenticationScheme"/>s for the known external login providers.</returns>
674+
/// <returns>A collection of <see cref="Authentication.AuthenticationScheme"/>s for the known external login providers.</returns>
675675
public virtual async Task<IEnumerable<AuthenticationScheme>> GetExternalAuthenticationSchemesAsync()
676676
{
677677
var schemes = await _schemes.GetAllSchemesAsync();

0 commit comments

Comments
 (0)