Show / Hide Table of Contents

Class MultitenantSignInManager<TUser, TTenant>

Provides the APIs for user sign in.

Inheritance
Object
SignInManager<TUser>
ExtendedSignInManager<TUser>
MultitenantSignInManager<TUser, TTenant>
Inherited Members
ExtendedSignInManager<TUser>.ExtendedUserManager
ExtendedSignInManager<TUser>.Options
ExtendedSignInManager<TUser>.TenantIdentityOptions
ExtendedSignInManager<TUser>.CreateImpersonatorUserPrincipalAsync()
ExtendedSignInManager<TUser>.OneTimePasswordSignInAsync(String)
ExtendedSignInManager<TUser>.OneTimePasswordSignInAsync(TUser)
ExtendedSignInManager<TUser>.ConfirmEmailAndSignInAsync(String)
ExtendedSignInManager<TUser>.ConfirmPhoneNumberAndSignInAsync(String)
ExtendedSignInManager<TUser>.CheckPasswordSignInAsync(TUser, String, Boolean)
ExtendedSignInManager<TUser>.TwoFactorAuthenticatorSignInAsync(String, Boolean, Boolean)
ExtendedSignInManager<TUser>.TwoFactorSignInAsync(String, String, Boolean, Boolean)
ExtendedSignInManager<TUser>.SignInOrTwoFactorAsync(TUser, Boolean, String, Boolean)
ExtendedSignInManager<TUser>.SignInAsync(TUser, AuthenticationProperties, String)
ExtendedSignInManager<TUser>.SignInWithClaimsAsync(TUser, Boolean, IEnumerable<Claim>)
ExtendedSignInManager<TUser>.ResetLockout(TUser)
ExtendedSignInManager<TUser>.ImpersonateSignInAsync(String, Boolean, String[])
ExtendedSignInManager<TUser>.ImpersonateSignInAsync(TUser, String[])
ExtendedSignInManager<TUser>.ImpersonateSignOutAsync()
ExtendedSignInManager<TUser>.ExternalLoginSignInAsync(Boolean)
ExtendedSignInManager<TUser>.SyncExternalRoles(TUser)
ExtendedSignInManager<TUser>.RefreshSignInAsync(TUser)
ExtendedSignInManager<TUser>.AutoLinkUserAsync(SignInResult, Boolean)
ExtendedSignInManager<TUser>.AutoLinkUserAsync(SignInResult, ExternalLoginInfo, Boolean)
ExtendedSignInManager<TUser>.GetExternalLoginInfoAsync(String)
ExtendedSignInManager<TUser>.BeginExternalLoginAsync(String, AuthenticationProperties)
ExtendedSignInManager<TUser>.CreateClaimFilterContextAsync(ExternalLoginInfo, String)
ExtendedSignInManager<TUser>.PostSignInCheck(TUser)
ExtendedSignInManager<TUser>.RequiresConfirmation(TUser)
ExtendedSignInManager<TUser>.CanSignInAsync(TUser)
ExtendedSignInManager<TUser>.AddRequiredInformationAndSignInAsync(String, String)
ExtendedSignInManager<TUser>.IsValidPhoneNumber(String)
ExtendedSignInManager<TUser>.MustChangePassword(TUser)
ExtendedSignInManager<TUser>.IsPasswordToOld(DateTimeOffset)
ExtendedSignInManager<TUser>.InvitedUserSignInAsync(String, String)
ExtendedSignInManager<TUser>.AssociatePasswordSignInAsync(String)
ExtendedSignInManager<TUser>.AssociateExternalLoginSignInAsyn(UserLoginInfo)
ExtendedSignInManager<TUser>.SaveUserNameCookieAsync(String)
ExtendedSignInManager<TUser>.GetUserNameCookieAsync()
ExtendedSignInManager<TUser>.GetTemporaryUserAsync()
ExtendedSignInManager<TUser>.GetTemporaryUserInfoAsync()
ExtendedSignInManager<TUser>.SaveTemporaryUserInfoAsync(String, String)
SignInManager<TUser>.CreateUserPrincipalAsync(TUser)
SignInManager<TUser>.IsSignedIn(ClaimsPrincipal)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.SignInAsync(TUser, System.Boolean, System.String)
SignInManager<TUser>.ValidateSecurityStampAsync(ClaimsPrincipal)
SignInManager<TUser>.ValidateTwoFactorSecurityStampAsync(ClaimsPrincipal)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.ValidateSecurityStampAsync(TUser, System.String)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.IsTwoFactorClientRememberedAsync(TUser)
SignInManager<TUser>.RememberTwoFactorClientAsync(TUser)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.ForgetTwoFactorClientAsync()
Microsoft.AspNetCore.Identity.SignInManager<TUser>.TwoFactorRecoveryCodeSignInAsync(System.String)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.ExternalLoginSignInAsync(System.String, System.String, System.Boolean, System.Boolean)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.GetExternalAuthenticationSchemesAsync()
Microsoft.AspNetCore.Identity.SignInManager<TUser>.UpdateExternalAuthenticationTokensAsync(Microsoft.AspNetCore.Identity.ExternalLoginInfo)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.ConfigureExternalAuthenticationProperties(System.String, System.String, System.String)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.IsLockedOut(TUser)
SignInManager<TUser>.LockedOut(TUser)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.PreSignInCheck(TUser)
SignInManager<TUser>.Logger
Microsoft.AspNetCore.Identity.SignInManager<TUser>.UserManager
SignInManager<TUser>.ClaimsFactory
Microsoft.AspNetCore.Identity.SignInManager<TUser>.Context
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class MultitenantSignInManager<TUser, TTenant> : ExtendedSignInManager<TUser>, IResolveTenant where TUser : class, IMultitenantUser where TTenant : class, IOrganisation
Type Parameters
TUser

The type encapsulating a user.

TTenant

The type encapsulating a tenant.

Constructors

MultitenantSignInManager(MultitenantUserManager<TUser>, IOrganisationManager, IHttpContextAccessor, IUserClaimsPrincipalFactory<TUser>, IOptions<ExtendedIdentityOptions>, IOptionsSnapshot<TenantIdentityOptions>, ExtendedIdentityErrorDescriber, ILogger<MultitenantSignInManager<TUser, TTenant>>, IAuthenticationSchemeProvider, ModuleManager)

Creates a new instance of MultitenantSignInManager<TUser, TTenant>.

Declaration
public MultitenantSignInManager(MultitenantUserManager<TUser> userManager, IOrganisationManager organisationManager, IHttpContextAccessor contextAccessor, IUserClaimsPrincipalFactory<TUser> claimsFactory, IOptions<ExtendedIdentityOptions> optionsAccessor, IOptionsSnapshot<TenantIdentityOptions> tenantIdentityOptionsAccessor, ExtendedIdentityErrorDescriber errorDescriber, ILogger<MultitenantSignInManager<TUser, TTenant>> logger, IAuthenticationSchemeProvider schemes, ModuleManager moduleManager = null)
Parameters
MultitenantUserManager<TUser> userManager

An instance of used to retrieve users from and persist users.

IOrganisationManager organisationManager

The organisation manager used to get tenant names from.

Microsoft.AspNetCore.Http.IHttpContextAccessor contextAccessor

The accessor used to access the Microsoft.AspNetCore.Http.HttpContext.

Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory<TUser> claimsFactory

The factory to use to create claims principals for a user.

Microsoft.Extensions.Options.IOptions<ExtendedIdentityOptions> optionsAccessor

The accessor used to access the Microsoft.AspNetCore.Builder.IdentityOptions.

IOptionsSnapshot<TenantIdentityOptions> tenantIdentityOptionsAccessor

The accessor used to access the TenantIdentityOptions.

ExtendedIdentityErrorDescriber errorDescriber

The ExtendedIdentityErrorDescriber used to provider error messages.

Microsoft.Extensions.Logging.ILogger<MultitenantSignInManager<TUser, TTenant>> logger

The logger used to log messages, warnings and errors.

Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemes

The scheme provider that is used enumerate the authentication schemes.

ModuleManager moduleManager

An instance of ModuleManager that will be used to check for unpayed modules when a user signs in.

Properties

MultitenantUserManager

Gets or sets the MultitenantUserManager<TUser> used by this sign-in manager.

Declaration
protected MultitenantUserManager<TUser> MultitenantUserManager { get; set; }
Property Value
MultitenantUserManager<TUser>

OrganisationManager

Gets or sets the IOrganisationManager used by this sign-in manager.

Declaration
protected IOrganisationManager OrganisationManager { get; set; }
Property Value
IOrganisationManager

Methods

ChooseTenantSignInAsync(Guid, Boolean, Boolean)

Chooses a tenant for a user that are associated with many tenants.

Declaration
public virtual async Task<SignInResult> ChooseTenantSignInAsync(Guid tenantId, bool isPersistent, bool lockoutOnFailure)
Parameters
System.Guid tenantId

The id of the tenant to choose.

Boolean isPersistent

Flag indicating whether the sign-in cookie should persist after the browser is closed.

Boolean lockoutOnFailure

Flag indicating if the user account should be locked if the sign in fails.

Returns
System.Threading.Tasks.Task<SignInResult>

The task object representing the asynchronous operation containing the for the sign-in attempt.

Implements
IResolveTenant.ChooseTenantSignInAsync(Guid, Boolean, Boolean)

CreateClaimFilterContextAsync(ClaimsPrincipal, String, String, Nullable<Guid>)

Creates a ClaimFilterContext<TUser> with the provided values and ExternalPrincipal set if there is an externa login.

Declaration
public override async Task<ClaimFilterContext<TUser>> CreateClaimFilterContextAsync(ClaimsPrincipal principal, string caller, string loginProvider, Guid? tenantId)
Parameters
System.Security.Claims.ClaimsPrincipal principal

The System.Security.Claims.ClaimsPrincipal for the user.

String caller

The action that is about to exeute claim filters.

String loginProvider

The login provider used.

System.Nullable<System.Guid> tenantId

The unique identity of the tenant (if any).

Returns
System.Threading.Tasks.Task<ClaimFilterContext<TUser>>

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the ClaimFilterContext<TUser>.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.CreateClaimFilterContextAsync(System.Security.Claims.ClaimsPrincipal, System.String, System.String, System.Nullable<System.Guid>)

CreateImpersonatedUserPrincipalAsync(TUser, String[])

Creates an impersonated System.Security.Claims.ClaimsPrincipal for the specified user, as an asynchronous operation.

Declaration
public override Task<ClaimsPrincipal> CreateImpersonatedUserPrincipalAsync(TUser user, params string[] actClaimTypesToInclude)
Parameters
TUser user

The user to create a System.Security.Claims.ClaimsPrincipal for.

String[] actClaimTypesToInclude

The types of claims to include in the act claim.

Returns
System.Threading.Tasks.Task<System.Security.Claims.ClaimsPrincipal>

The task object representing the asynchronous operation, containing the System.Security.Claims.ClaimsPrincipal for the specified user.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.CreateImpersonatedUserPrincipalAsync(TUser, System.String[])

ExternalLoginSignInAsync(ExternalLoginInfo, Boolean)

Signs in a user via a previously registered third party login, as an asynchronous operation.

Declaration
public override Task<SignInResult> ExternalLoginSignInAsync(ExternalLoginInfo loginInfo, bool isPersistent)
Parameters
Microsoft.AspNetCore.Identity.ExternalLoginInfo loginInfo

Login information, source and externally sourced principal.

Boolean isPersistent

Flag indicating whether the sign-in cookie should persist after the browser is closed.

Returns
System.Threading.Tasks.Task<SignInResult>

The task object representing the asynchronous operation containing the for the sign-in attempt.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.ExternalLoginSignInAsync(Microsoft.AspNetCore.Identity.ExternalLoginInfo, System.Boolean)

ExternalLoginSignInAsync(String, String, Boolean)

Signs in a user via a previously registered third party login, as an asynchronous operation.

Declaration
public override Task<SignInResult> ExternalLoginSignInAsync(string loginProvider, string providerKey, bool isPersistent)
Parameters
String loginProvider

The login provider to use.

String providerKey

The unique provider identifier for the user.

Boolean isPersistent

Flag indicating whether the sign-in cookie should persist after the browser is closed.

Returns
System.Threading.Tasks.Task<SignInResult>

The task object representing the asynchronous operation containing the for the sign-in attempt.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.ExternalLoginSignInAsync(System.String, System.String, System.Boolean)

FindUserToAutoLinkAsync(ExternalLoginInfo, TemporaryUserLoginInfo)

Tries to find a user that can be automatically linked based on the Microsoft.AspNetCore.Identity.ExternalLoginInfo.

Declaration
protected override async Task<TUser> FindUserToAutoLinkAsync(ExternalLoginInfo info, TemporaryUserLoginInfo temporaryUser)
Parameters
Microsoft.AspNetCore.Identity.ExternalLoginInfo info

The Microsoft.AspNetCore.Identity.ExternalLoginInfo which values can be used to find a user.

TemporaryUserLoginInfo temporaryUser

Optionally information about a temporary user that has started a sign-in flow. This can be null and that should not cause any exceptions.

Returns
System.Threading.Tasks.Task<TUser>

A TUser if a user is found, otherwise null.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.FindUserToAutoLinkAsync(Microsoft.AspNetCore.Identity.ExternalLoginInfo, IRM.AspNetCore.Identity.TemporaryUserLoginInfo)

GetChooseTenantAuthenticationUserAsync()

Gets the collection of organisations for the current login, as an asynchronous operation.

Declaration
public virtual async Task<List<IOrganisation>> GetChooseTenantAuthenticationUserAsync()
Returns
System.Threading.Tasks.Task<List<IOrganisation>>

The task object representing the asynchronous operation containing the organisations for the sign-in attempt.

GetSavedUserNameAsync()

Gets a saved user name (if any), as an asynchronous operation.

Declaration
public override async Task<string> GetSavedUserNameAsync()
Returns
System.Threading.Tasks.Task<String>

The task object representing the asynchronous operation containing the user name.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.GetSavedUserNameAsync()

GetTwoFactorAuthenticationUserAsync()

Declaration
public override Task<TUser> GetTwoFactorAuthenticationUserAsync()
Returns
System.Threading.Tasks.Task<TUser>

Overrides
Microsoft.AspNetCore.Identity.SignInManager<TUser>.GetTwoFactorAuthenticationUserAsync()

PasswordSignInAsync(TUser, String, Boolean, Boolean)

Declaration
public override async Task<SignInResult> PasswordSignInAsync(TUser user, string password, bool isPersistent, bool lockoutOnFailure)
Parameters
TUser user

String password

Boolean isPersistent

Boolean lockoutOnFailure

Returns
System.Threading.Tasks.Task<SignInResult>

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.PasswordSignInAsync(TUser, System.String, System.Boolean, System.Boolean)

PasswordSignInAsync(String, String, Boolean, Boolean)

Attempts to sign in the specified userName and password combination as an asynchronous operation.

Declaration
public override async Task<SignInResult> PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure)
Parameters
String userName

The user name to sign in.

String password

The password to attempt to sign in with.

Boolean isPersistent

Flag indicating whether the sign-in cookie should persist after the browser is closed.

Boolean lockoutOnFailure

Flag indicating if the user account should be locked if the sign in fails.

Returns
System.Threading.Tasks.Task<SignInResult>

The task object representing the asynchronous operation containing the for the sign-in attempt.

Overrides
Microsoft.AspNetCore.Identity.SignInManager<TUser>.PasswordSignInAsync(System.String, System.String, System.Boolean, System.Boolean)

PublishSignInFailed(SignInResult, TUser)

Audits a sign-in, if auditing is used.

Declaration
protected override Task PublishSignInFailed(SignInResult result, TUser user)
Parameters
SignInResult result

The SignInResult to audit.

TUser user

The user to audit the failure for.

Returns
System.Threading.Tasks.Task

The task object representing the asynchronous operation for the auditing.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.PublishSignInFailed(Microsoft.AspNetCore.Identity.SignInResult, TUser)

ReconfigureTenantIdentityOptions(Nullable<Guid>)

Reconfigures the TenantIdentityOptions for the tenantId.

Declaration
public override async Task<bool> ReconfigureTenantIdentityOptions(Guid? tenantId)
Parameters
System.Nullable<System.Guid> tenantId

The tenant to reconfigure the TenantIdentityOptions for.

Returns
System.Threading.Tasks.Task<Boolean>

True if TenantIdentityOptions has been reconfigured, otherwise false.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.ReconfigureTenantIdentityOptions(System.Nullable<System.Guid>)

RetrieveTemporaryTenantAsync()

Gets temporary tenant information, if any is available, as an asynchronous operation.

Declaration
public Task<Guid?> RetrieveTemporaryTenantAsync()
Returns
System.Threading.Tasks.Task<System.Nullable<System.Guid>>

The unique identity of the tenant, or null if no tenant information is available.

Implements
IResolveTenant.RetrieveTemporaryTenantAsync()

SaveTemporaryTenantAsync(TUser)

Declaration
protected override Task SaveTemporaryTenantAsync(TUser user)
Parameters
TUser user

Returns
System.Threading.Tasks.Task

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.SaveTemporaryTenantAsync(TUser)

SaveTemporaryTenantAsync(IUser)

Saves temporary tenant information, as an asynchronous operation.

Declaration
public Task SaveTemporaryTenantAsync(IUser user)
Parameters
IUser user

The user to get the tenant from.

Returns
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Implements
IResolveTenant.SaveTemporaryTenantAsync(IUser)

SaveTemporaryTenantAsync(Guid)

Saves temporary tenant information, as an asynchronous operation.

Declaration
public async Task SaveTemporaryTenantAsync(Guid tenantId)
Parameters
System.Guid tenantId

The unique identity of the tenant.

Returns
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Implements
IResolveTenant.SaveTemporaryTenantAsync(Guid)

SaveUserNameAsync(String)

Saves a user name in a cookie, as an asynchronous operation.

Declaration
public override async Task SaveUserNameAsync(string username)
Parameters
String username

Returns
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.SaveUserNameAsync(System.String)

SignInWithClaimsAsync(TUser, AuthenticationProperties, IEnumerable<Claim>)

Signs in the specified user.

Declaration
public override async Task SignInWithClaimsAsync(TUser user, AuthenticationProperties authenticationProperties, IEnumerable<Claim> additionalClaims)
Parameters
TUser user

The user to sign-in.

Microsoft.AspNetCore.Authentication.AuthenticationProperties authenticationProperties

Properties applied to the login and authentication cookie.

IEnumerable<System.Security.Claims.Claim> additionalClaims

Additional claims that will be stored in the cookie.

Returns
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.SignInWithClaimsAsync(TUser, Microsoft.AspNetCore.Authentication.AuthenticationProperties, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>)

SignOutAsync()

Declaration
public override async Task SignOutAsync()
Returns
System.Threading.Tasks.Task

Overrides
IRM.AspNetCore.Identity.ExtendedSignInManager<TUser>.SignOutAsync()

Explicit Interface Implementations

IResolveTenant.DeleteTemporaryTenantAsync()

Declaration
async Task IResolveTenant.DeleteTemporaryTenantAsync()
Returns
System.Threading.Tasks.Task

Implements
IResolveTenant.DeleteTemporaryTenantAsync()

IResolveTenant.GetLastSelectedTenantIndex()

Declaration
async Task<int> IResolveTenant.GetLastSelectedTenantIndex()
Returns
System.Threading.Tasks.Task<System.Int32>

Implements
IResolveTenant.GetLastSelectedTenantIndex()

IResolveTenant.GetOrganisationKeysForUsernameDomainAsync(String)

Declaration
async Task<OrganisationKeys> IResolveTenant.GetOrganisationKeysForUsernameDomainAsync(string username)
Parameters
String username

Returns
System.Threading.Tasks.Task<OrganisationKeys>

Implements
IResolveTenant.GetOrganisationKeysForUsernameDomainAsync(String)

IResolveTenant.GetTenantsAsync(Guid[])

Declaration
async Task<List<IOrganisation>> IResolveTenant.GetTenantsAsync(params Guid[] tenantIds)
Parameters
System.Guid[] tenantIds

Returns
System.Threading.Tasks.Task<List<IOrganisation>>

Implements
IResolveTenant.GetTenantsAsync(Guid[])

Extension Methods

ExtendedSignInManagerExtensions.GetTenantIdAsync<TUser>(SignInManager<TUser>, String, Boolean)
ExtendedSignInManagerExtensions.GetTenantResolver<TUser>(SignInManager<TUser>, Boolean)
Back to top Generated by DocFX