Class MultitenantSignInManager<TUser, TTenant>
Provides the APIs for user sign in.
Inheritance
Inherited Members
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 |
|
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 |
Implements
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
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
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 |
Overrides
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 |
Overrides
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 |
Overrides
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
GetTwoFactorAuthenticationUserAsync()
Declaration
public override Task<TUser> GetTwoFactorAuthenticationUserAsync()
Returns
|
System.Threading.Tasks.Task<TUser>
|
Overrides
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
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 |
Overrides
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
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
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
SaveTemporaryTenantAsync(TUser)
Declaration
protected override Task SaveTemporaryTenantAsync(TUser user)
Parameters
|
TUser
user
|
Returns
|
System.Threading.Tasks.Task
|
Overrides
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
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
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
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
SignOutAsync()
Declaration
public override async Task SignOutAsync()
Returns
|
System.Threading.Tasks.Task
|
Overrides
Explicit Interface Implementations
IResolveTenant.DeleteTemporaryTenantAsync()
Declaration
async Task IResolveTenant.DeleteTemporaryTenantAsync()
Returns
|
System.Threading.Tasks.Task
|
Implements
IResolveTenant.GetLastSelectedTenantIndex()
Declaration
async Task<int> IResolveTenant.GetLastSelectedTenantIndex()
Returns
|
System.Threading.Tasks.Task<System.Int32>
|
Implements
IResolveTenant.GetOrganisationKeysForUsernameDomainAsync(String)
Declaration
async Task<OrganisationKeys> IResolveTenant.GetOrganisationKeysForUsernameDomainAsync(string username)
Parameters
|
String
username
|
Returns
|
System.Threading.Tasks.Task<OrganisationKeys>
|
Implements
IResolveTenant.GetTenantsAsync(Guid[])
Declaration
async Task<List<IOrganisation>> IResolveTenant.GetTenantsAsync(params Guid[] tenantIds)
Parameters
|
System.Guid[]
tenantIds
|
Returns
|
System.Threading.Tasks.Task<List<IOrganisation>>
|