Class SignInProviderFactory<TUser>
Provides methods to create a ExternalProviders.
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class SignInProviderFactory<TUser>
where TUser : class, IUser
Type Parameters
|
TUser
The type used to represent a user. |
Constructors
SignInProviderFactory(ExtendedSignInManager<TUser>, ExtendedUserManager<TUser>, IAuthenticationSchemeProvider, IOptions<ExtendedIdentityOptions>, WindowsAuthenticationSignInProviderOptions)
Creates a new instance of SignInProviderFactory<TUser>.
Declaration
public SignInProviderFactory(ExtendedSignInManager<TUser> signInManager, ExtendedUserManager<TUser> userManager, IAuthenticationSchemeProvider authenticationSchemeProvider, IOptions<ExtendedIdentityOptions> optionsAccessor, WindowsAuthenticationSignInProviderOptions windowsAuthenticationOptions = null)
Parameters
|
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. |
|
WindowsAuthenticationSignInProviderOptions
windowsAuthenticationOptions
The windows authentication options. |
Properties
SchemesToIgnore
Gets a func to filter out Microsoft.AspNetCore.Authentication.AuthenticationSchemes that should never be presented to the user.
Declaration
protected Func<AuthenticationScheme, bool> SchemesToIgnore { get; }
Property Value
|
System.Func<Microsoft.AspNetCore.Authentication.AuthenticationScheme, Boolean>
|
Methods
CanUserSingInWithOtp(TUser)
Gets if user can sign-in with one-time password.
Declaration
protected virtual async Task<bool> CanUserSingInWithOtp(TUser user)
Parameters
|
TUser
user
The user to check. |
Returns
|
System.Threading.Tasks.Task<Boolean>
true if the user can sign-in with one-time password; otherwise false. |
CompareLoginProvider(String, Boolean)
Declaration
protected Func<UserLoginInfo, bool> CompareLoginProvider(string loginProvider, bool equal = true)
Parameters
|
String
loginProvider
|
|
Boolean
equal
|
Returns
|
System.Func<Microsoft.AspNetCore.Identity.UserLoginInfo, Boolean>
|
ConfigureExternalAuthenticationProperties(String, String, String, String, String, ClaimsPrincipal)
Configures the redirect URL and user related properties for the specified external login provider.
Declaration
public virtual async Task<AuthenticationProperties> ConfigureExternalAuthenticationProperties(string provider, string redirectUrl, string cancelRedirectUrl, string returnUrl = null, 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 |
CreateAutoProvisionAlternativesAsync(Guid)
Determines what auto-provision alternatives that should be presented for a user.
Declaration
public virtual 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. |
CreateExternalProviderAsync(AuthenticationScheme)
Creates an ExternalProvider from an Microsoft.AspNetCore.Authentication.AuthenticationScheme.
Declaration
protected virtual 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. |
CreateSignInAlternativesAsync(IEnumerable<TUser>)
Determines what sign-in alternatives that should be presented for a user.
Declaration
public virtual async Task<SignInAlternatives> CreateSignInAlternativesAsync(IEnumerable<TUser> users)
Parameters
|
IEnumerable<TUser>
users
One or more possible users. |
Returns
|
System.Threading.Tasks.Task<SignInAlternatives>
The SignInAlternatives that should be presented for a user. |
CreateSocialProvider(String, String)
Creates a SocialProvider for the supplied displayName and authenticationScheme.
Declaration
protected SocialProvider CreateSocialProvider(string displayName, string authenticationScheme)
Parameters
|
String
displayName
The display name for the authentication provider. |
|
String
authenticationScheme
The name used to reference the authentication middelware instance. |
Returns
|
SocialProvider
Returns a SocialProvider. |
CreateTenantProvider(String, String, Guid)
Creates a TenantProvider for the supplied displayName, authenticationScheme and tenantId.
Declaration
protected TenantProvider CreateTenantProvider(string displayName, string authenticationScheme, Guid tenantId)
Parameters
|
String
displayName
The display name for the authentication provider. |
|
String
authenticationScheme
The name used to reference the authentication middelware instance. |
|
System.Guid
tenantId
The unique identifier of the tenant. |
Returns
|
TenantProvider
Returns a TenantProvider. |
CreateUsedAndUnusedExternalProvidersForAsync(TUser)
Creates a collection of all ExternalProviders that does not exists in the user logins.
Declaration
public virtual 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. |
CreateWindowsProvider(String, String)
Creates a WindowsProvider for the supplied displayName and authenticationScheme.
Declaration
protected WindowsProvider CreateWindowsProvider(string displayName, string authenticationScheme)
Parameters
|
String
displayName
The display name for the authentication provider. |
|
String
authenticationScheme
The name used to reference the authentication middelware instance. |
Returns
|
WindowsProvider
Returns a WindowsProvider. |
EnableLocalSignInAsync(TUser)
Gets if a local sign-in with password should be enabled for the user.
Declaration
public virtual bool EnableLocalSignInAsync(TUser user)
Parameters
|
TUser
user
The user. |
Returns
|
Boolean
True if a local sign-in with password should be enabled, otherwise False. |
GetAllExternalProvidersAsync()
Gets a collection of all configured ExternalProviders.
Declaration
public virtual async Task<List<ExternalProvider>> GetAllExternalProvidersAsync()
Returns
|
System.Threading.Tasks.Task<List<ExternalProvider>>
A collection of all configured ExternalProviders. |
GetAllExternalProvidersForAsync(TUser)
Gets a collection of all configured ExternalProviders.
Declaration
public virtual 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. |
GetExternalProvider(String, Nullable<Guid>)
Gets an ExternalProvider with schemeName, if it exists.
Declaration
public virtual 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 |
GetExternalProvidersForAsync(TUser)
Gets a collection of ExternalProviders that can be used by user.
Declaration
public virtual async Task<List<ExternalProvider>> GetExternalProvidersForAsync(TUser user)
Parameters
|
TUser
user
The user to get external providers for. |
Returns
|
System.Threading.Tasks.Task<List<ExternalProvider>>
A collection of all configured ExternalProviders. |
GetOtpProviderAsync(TUser)
Gets a one-time password sign-in provider, if one is available for the user.
Declaration
protected virtual 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. |
IsLocalAllowedAsync(TUser)
Gets if a local sign-in is allowed for a user.
Declaration
public virtual 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. |
IsLocalAllowedAsync(Guid)
Gets if a local sign-in is allowed for an organisation.
Declaration
public virtual 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. |