Class MultitenantSignInProviderFactory<TUser, TTenantOidcSetting>
Provides methods to create a ExternalProviders in a multi-tenant solution.
Inheritance
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class MultitenantSignInProviderFactory<TUser, TTenantOidcSetting> : SignInProviderFactory<TUser> where TUser : class, IMultitenantUser where TTenantOidcSetting : class, ITenantAuthenticationScheme
Type Parameters
|
TUser
The type used to represent a user. |
|
TTenantOidcSetting
The type of the tenant OpenID Connect setting object. |
Constructors
MultitenantSignInProviderFactory(TenantConfigurationManager<TTenantOidcSetting>, TenantSettingsManager, ITenantAuthenticationSchemeProvider, ExtendedSignInManager<TUser>, ExtendedUserManager<TUser>, IAuthenticationSchemeProvider, IOptions<ExtendedIdentityOptions>, ILogger<MultitenantSignInProviderFactory<TUser, TTenantOidcSetting>>, WindowsAuthenticationSignInProviderOptions)
Creates a new instance of MultitenantSignInProviderFactory<TUser, TTenantOidcSetting>.
Declaration
public MultitenantSignInProviderFactory(TenantConfigurationManager<TTenantOidcSetting> configurationManager, TenantSettingsManager authenticationSettingsManager, ITenantAuthenticationSchemeProvider tenantAuthenticationSchemeProvider, ExtendedSignInManager<TUser> signInManager, ExtendedUserManager<TUser> userManager, IAuthenticationSchemeProvider authenticationSchemeProvider, IOptions<ExtendedIdentityOptions> optionsAccessor, ILogger<MultitenantSignInProviderFactory<TUser, TTenantOidcSetting>> logger, WindowsAuthenticationSignInProviderOptions windowsAuthenticationOptions = null)
Parameters
|
TenantConfigurationManager<TTenantOidcSetting>
configurationManager
An instance of TenantConfigurationManager<TTenantOidcSetting> used to retrieve tenant settings from. |
|
TenantSettingsManager
authenticationSettingsManager
An instance of TenantSettingsManager used to retrieve tenant authentication settings from. |
|
ITenantAuthenticationSchemeProvider
tenantAuthenticationSchemeProvider
|
|
ExtendedSignInManager<TUser>
signInManager
An instance of ExtendedSignInManager<TUser> used to sign in users. |
|
ExtendedUserManager<TUser>
userManager
An instance of ExtendedUserManager<TUser> used to retrieve users from. |
|
Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider
authenticationSchemeProvider
|
|
Microsoft.Extensions.Options.IOptions<ExtendedIdentityOptions>
optionsAccessor
The accessor used to access the Microsoft.AspNetCore.Builder.IdentityOptions. |
|
Microsoft.Extensions.Logging.ILogger<MultitenantSignInProviderFactory<TUser, TTenantOidcSetting>>
logger
The logger used to log messages, warnings and errors. |
|
WindowsAuthenticationSignInProviderOptions
windowsAuthenticationOptions
The windows authentication options. |
Methods
ConfigureExternalAuthenticationProperties(String, String, String, String, String, ClaimsPrincipal)
Configures the redirect URL and user related properties for the specified external login provider.
Declaration
public override async Task<AuthenticationProperties> ConfigureExternalAuthenticationProperties(string provider, string redirectUrl, string cancelRedirectUrl, string returnUrl, string email = null, ClaimsPrincipal user = null)
Parameters
|
String
provider
The provider to configure. |
|
String
redirectUrl
The external login URL users should be redirected to during the login flow. |
|
String
cancelRedirectUrl
The cancel redirect url that should be used by the external authantication, if it supports cancelation. |
|
String
returnUrl
The return URL users should be redirected to after the login flow. |
|
String
email
|
|
System.Security.Claims.ClaimsPrincipal
user
The System.Security.Claims.ClaimsPrincipal for an authenticated user. |
Returns
|
System.Threading.Tasks.Task<Microsoft.AspNetCore.Authentication.AuthenticationProperties>
A configured Microsoft.AspNetCore.Authentication.AuthenticationProperties |
Overrides
CreateAutoProvisionAlternativesAsync(Guid)
Determines what auto-provision alternatives that should be presented for a user.
Declaration
public override async Task<SignInAlternatives> CreateAutoProvisionAlternativesAsync(Guid organisationId)
Parameters
|
System.Guid
organisationId
The identity of the organisation that the user should belong to. |
Returns
|
System.Threading.Tasks.Task<SignInAlternatives>
The SignInAlternatives that should be presented for a user. |
Overrides
CreateExternalProvider(AuthenticationScheme, Guid, IdentityAuthenticationScheme)
Creates an ExternalProvider from an Microsoft.AspNetCore.Authentication.AuthenticationScheme.
Declaration
protected ExternalProvider CreateExternalProvider(AuthenticationScheme scheme, Guid tenantId, IdentityAuthenticationScheme identityScheme = null)
Parameters
|
Microsoft.AspNetCore.Authentication.AuthenticationScheme
scheme
Information about a configured authentication scheme. |
|
System.Guid
tenantId
Unique identifier for the tenant. |
|
IdentityAuthenticationScheme
identityScheme
An optional IdentityAuthenticationScheme that will override the DisplayName if supplied. |
Returns
|
ExternalProvider
Returns an ExternalProvider representing the configured authentication provider. |
CreateExternalProviderAsync(AuthenticationScheme)
Creates an ExternalProvider from an Microsoft.AspNetCore.Authentication.AuthenticationScheme.
Declaration
protected override async Task<ExternalProvider> CreateExternalProviderAsync(AuthenticationScheme scheme)
Parameters
|
Microsoft.AspNetCore.Authentication.AuthenticationScheme
scheme
Information about a configured authentication scheme. |
Returns
|
System.Threading.Tasks.Task<ExternalProvider>
Returns an ExternalProvider representing the configured authentication provider. |
Overrides
CreateUsedAndUnusedExternalProvidersForAsync(TUser)
Creates a collection of all ExternalProviders that does not exists in the user logins.
Declaration
public override async Task<UserLogins> CreateUsedAndUnusedExternalProvidersForAsync(TUser user)
Parameters
|
TUser
user
The user. |
Returns
|
System.Threading.Tasks.Task<UserLogins>
A collection of all ExternalProviders that does not exists in the user logins. |
Overrides
GetAllExternalProvidersAsync()
Gets a collection of all configured ExternalProviders.
Declaration
public override async Task<List<ExternalProvider>> GetAllExternalProvidersAsync()
Returns
|
System.Threading.Tasks.Task<List<ExternalProvider>>
A collection of all configured ExternalProviders. |
Overrides
GetAllExternalProvidersForAsync(TUser)
Gets a collection of all configured ExternalProviders.
Declaration
public override async Task<List<ExternalProvider>> GetAllExternalProvidersForAsync(TUser user)
Parameters
|
TUser
user
The user to get all external providers for. |
Returns
|
System.Threading.Tasks.Task<List<ExternalProvider>>
A collection of all configured ExternalProviders. |
Overrides
GetAutoProvisionExternalProvidersForAsync(Guid)
Gets a collection of ExternalProviders that should be used to auto-provision new users.
Declaration
public async Task<List<ExternalProvider>> GetAutoProvisionExternalProvidersForAsync(Guid tenantId)
Parameters
|
System.Guid
tenantId
The unique identifier of a tenant to create external providers for. |
Returns
|
System.Threading.Tasks.Task<List<ExternalProvider>>
A collection of ExternalProviders that should be used to auto-provision new users. |
GetExternalProvider(String, Nullable<Guid>)
Gets an ExternalProvider with schemeName, if it exists.
Declaration
public override async Task<ExternalProvider> GetExternalProvider(string schemeName, Guid? organisationId = null)
Parameters
|
String
schemeName
The name of the scheme to get. |
|
System.Nullable<System.Guid>
organisationId
The identity of the organisation that the provider should be allowed for. |
Returns
|
System.Threading.Tasks.Task<ExternalProvider>
An ExternalProvider with |
Overrides
GetOtpProviderAsync(TUser)
Gets a one-time password sign-in provider, if one is available for the user.
Declaration
protected override async Task<ExternalProvider> GetOtpProviderAsync(TUser user)
Parameters
|
TUser
user
The user to try get a one-time password provider for. |
Returns
|
System.Threading.Tasks.Task<ExternalProvider>
ExternalProvider for one-time password, if one is available, or null if none is available. |
Overrides
IsLocalAllowedAsync(TUser)
Gets if a local sign-in is allowed for a user.
Declaration
public override async Task<bool> IsLocalAllowedAsync(TUser user)
Parameters
|
TUser
user
The user to get if local sign-in is allowed. |
Returns
|
System.Threading.Tasks.Task<Boolean>
true if local sign-in is allowed; otherwise false. |
Overrides
IsLocalAllowedAsync(Guid)
Gets if a local sign-in is allowed for an organisation.
Declaration
public override async Task<bool> IsLocalAllowedAsync(Guid organisationId)
Parameters
|
System.Guid
organisationId
The organisation identity to get if local sign-in is allowed. |
Returns
|
System.Threading.Tasks.Task<Boolean>
true if local sign-in is allowed; otherwise false. |