Skip to main content
Table of Contents

Class AspNetSignInManager<TUser>

Namespace
Stratara.Identity.AspNetCore.Services
Assembly
Stratara.Identity.AspNetCore.dll

Channel-agnostic ASP.NET Core implementation of IStrataraSignInManager that wraps the ASP.NET Core SignInManager<TUser> + UserManager<TUser> and translates every outcome into the unified StrataraSignInResult. Failure messages are resolved via IStringLocalizer<T> (anchored on IdentityResources), so the current CurrentUICulture decides the language. English is the default resource set; German overrides ship as IdentityResources.de.resx.

public sealed class AspNetSignInManager<TUser> : IStrataraSignInManager where TUser : class, new()

Type Parameters

TUser

The ASP.NET Core Identity user type.

Inheritance
AspNetSignInManager<TUser>
Implements
Inherited Members
Extension Methods

Constructors

AspNetSignInManager(SignInManager<TUser>, UserManager<TUser>, IStringLocalizer<IdentityResources>)

Channel-agnostic ASP.NET Core implementation of IStrataraSignInManager that wraps the ASP.NET Core SignInManager<TUser> + UserManager<TUser> and translates every outcome into the unified StrataraSignInResult. Failure messages are resolved via IStringLocalizer<T> (anchored on IdentityResources), so the current CurrentUICulture decides the language. English is the default resource set; German overrides ship as IdentityResources.de.resx.

public AspNetSignInManager(SignInManager<TUser> signInManager, UserManager<TUser> userManager, IStringLocalizer<IdentityResources> localizer)

Parameters

signInManager SignInManager<TUser>
userManager UserManager<TUser>
localizer IStringLocalizer<IdentityResources>

Methods

PasswordSignInAsync(string, string, bool, bool, CancellationToken)

Performs a password sign-in.

public Task<StrataraSignInResult> PasswordSignInAsync(string email, string password, bool isPersistent, bool lockoutOnFailure, CancellationToken cancellationToken = default)

Parameters

email string

User email.

password string

User password.

isPersistent bool

Whether the resulting session should persist.

lockoutOnFailure bool

Whether repeated failures should advance the lockout counter.

cancellationToken CancellationToken

Propagated to the underlying identity stack and any HTTP / DB calls.

Returns

Task<StrataraSignInResult>

RefreshSignInAsync(AccessTokenInfo, CancellationToken)

Refreshes the current sign-in using the given AccessTokenInfo's refresh token.

public Task<bool> RefreshSignInAsync(AccessTokenInfo tokenInfo, CancellationToken cancellationToken = default)

Parameters

tokenInfo AccessTokenInfo

The current access-token info.

cancellationToken CancellationToken

Propagated to the refresh HTTP call and any subsequent token-persist.

Returns

Task<bool>

true when the refresh succeeded and a new token was persisted; false otherwise.

Remarks

Not supported on server-side Blazor. The authentication session is managed by the ASP.NET Core authentication middleware (cookie-based), so there is no token-refresh flow. Token-refresh applies to non-web hosts (mobile, desktop) that talk to the identity HTTP endpoints directly.

SignOutAsync(CancellationToken)

Signs the current user out and clears any persisted token state.

public Task SignOutAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Propagated to the underlying identity stack and any HTTP / DB calls.

Returns

Task

TwoFactorAuthenticatorSignInAsync(string, bool, bool, CancellationToken)

Completes a two-factor sign-in step using a TOTP code.

public Task<StrataraSignInResult> TwoFactorAuthenticatorSignInAsync(string code, bool isPersistent, bool rememberClient, CancellationToken cancellationToken = default)

Parameters

code string

TOTP authenticator code.

isPersistent bool

Whether the resulting session should persist.

rememberClient bool

Whether to remember this client to skip future two-factor prompts.

cancellationToken CancellationToken

Propagated to the underlying identity stack and any HTTP / DB calls.

Returns

Task<StrataraSignInResult>

TwoFactorRecoveryCodeSignInAsync(string, CancellationToken)

Completes a two-factor sign-in step using a recovery code.

public Task<StrataraSignInResult> TwoFactorRecoveryCodeSignInAsync(string recoveryCode, CancellationToken cancellationToken = default)

Parameters

recoveryCode string

Recovery code from the user's printed list.

cancellationToken CancellationToken

Propagated to the underlying identity stack and any HTTP / DB calls.

Returns

Task<StrataraSignInResult>