Class UmbracoUserStore<TUser, TRole>
Inheritance
Namespace: Umbraco.Cms.Core.Security
Assembly: Umbraco.Infrastructure.dll
Syntax
public abstract class UmbracoUserStore<TUser, TRole> : UserStoreBase<TUser, TRole, string, IdentityUserClaim<string>, IdentityUserRole<string>, IdentityUserLogin<string>, IdentityUserToken<string>, IdentityRoleClaim<string>> where TUser : UmbracoIdentityUser where TRole : IdentityRole<string>
Type Parameters
| Name | Description |
|---|---|
| TUser | |
| TRole |
Constructors
View SourceUmbracoUserStore(IdentityErrorDescriber)
Declaration
protected UmbracoUserStore(IdentityErrorDescriber describer)
Parameters
| Type | Name | Description |
|---|---|---|
| IdentityErrorDescriber | describer |
Properties
View SourceUsers
Not supported in Umbraco
Declaration
public override IQueryable<TUser> Users { get; }
Property Value
| Type | Description |
|---|---|
| IQueryable<TUser> |
Methods
View SourceAddClaimsAsync(TUser, IEnumerable<Claim>, CancellationToken)
Not supported in Umbraco
Declaration
public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user to add the claim to. |
| IEnumerable<Claim> | claims | The claim to add to the user. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
AddToRoleAsync(TUser, string, CancellationToken)
Adds a user to a role (user group)
Declaration
public override Task AddToRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | |
| string | normalizedRoleName | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
AddUserTokenAsync(IdentityUserToken<string>)
Not supported in Umbraco, see comments above on GetTokenAsync, RemoveTokenAsync, SetTokenAsync
Declaration
protected override Task AddUserTokenAsync(IdentityUserToken<string> token)
Parameters
| Type | Name | Description |
|---|---|---|
| IdentityUserToken<string> | token | The token to be added. |
Returns
| Type | Description |
|---|---|
| Task |
FindByIdAsync(string, CancellationToken)
Finds and returns a user, if any, who has the specified userId.
Declaration
public override Task<TUser?> FindByIdAsync(string userId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userId | The user ID to search for. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<TUser> | The System.Threading.Tasks.Task that represents the asynchronous operation, containing the user matching the specified |
FindTokenAsync(TUser, string, string, CancellationToken)
Not supported in Umbraco, see comments above on GetTokenAsync, RemoveTokenAsync, SetTokenAsync
Declaration
protected override Task<IdentityUserToken<string>?> FindTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The token owner. |
| string | loginProvider | The login provider for the token. |
| string | name | The name of the token. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<IdentityUserToken<string>> | The user token if it exists. |
GetClaimsAsync(TUser, CancellationToken)
Not supported in Umbraco
Declaration
public override Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose claims should be retrieved. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<IList<Claim>> | A System.Threading.Tasks.Task<TResult> that contains the claims granted to a user. |
GetNormalizedEmailAsync(TUser, CancellationToken)
Returns the normalized email for the specified user.
Declaration
public override Task<string?> GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose email address to retrieve. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<string> | The task object containing the results of the asynchronous lookup operation, the normalized email address if any associated with the specified user. |
GetNormalizedUserNameAsync(TUser, CancellationToken)
Gets the normalized user name for the specified user.
Declaration
public override Task<string?> GetNormalizedUserNameAsync(TUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose normalized name should be retrieved. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<string> | The System.Threading.Tasks.Task that represents the asynchronous operation, containing the normalized user name for the specified |
GetRolesAsync(TUser, CancellationToken)
Gets a list of role names the specified user belongs to.
Declaration
public override Task<IList<string>> GetRolesAsync(TUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IList<string>> |
GetSecurityStampAsync(TUser, CancellationToken)
Get the security stamp for the specified user.
Declaration
public override Task<string?> GetSecurityStampAsync(TUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose security stamp should be set. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<string> | The System.Threading.Tasks.Task that represents the asynchronous operation, containing the security stamp for the specified |
GetUsersForClaimAsync(Claim, CancellationToken)
Not supported in Umbraco
Declaration
public override Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Claim | claim | The claim whose users should be retrieved. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<IList<TUser>> | The System.Threading.Tasks.Task contains a list of users, if any, that contain the specified claim. |
HasPasswordAsync(TUser, CancellationToken)
Returns a flag indicating if the specified user has a password.
Declaration
public override Task<bool> HasPasswordAsync(TUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user to retrieve the password hash for. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task<bool> | A System.Threading.Tasks.Task<TResult> containing a flag indicating if the specified user has a password. If the user has a password the returned value with be true, otherwise it will be false. |
IsInRoleAsync(TUser, string, CancellationToken)
Returns true if a user is in the role
Declaration
public override Task<bool> IsInRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | |
| string | normalizedRoleName | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> |
RemoveClaimsAsync(TUser, IEnumerable<Claim>, CancellationToken)
Not supported in Umbraco
Declaration
public override Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user to remove the claims from. |
| IEnumerable<Claim> | claims | The claim to remove. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
RemoveFromRoleAsync(TUser, string, CancellationToken)
Removes the role (user group) for the user
Declaration
public override Task RemoveFromRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | |
| string | normalizedRoleName | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
RemoveUserTokenAsync(IdentityUserToken<string>)
Not supported in Umbraco, see comments above on GetTokenAsync, RemoveTokenAsync, SetTokenAsync
Declaration
protected override Task RemoveUserTokenAsync(IdentityUserToken<string> token)
Parameters
| Type | Name | Description |
|---|---|---|
| IdentityUserToken<string> | token | The token to be removed. |
Returns
| Type | Description |
|---|---|
| Task |
ReplaceClaimAsync(TUser, Claim, Claim, CancellationToken)
Not supported in Umbraco
Declaration
public override Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user to replace the claim on. |
| Claim | claim | The claim replace. |
| Claim | newClaim | The new claim replacing the |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
ResolveEntityIdFromIdentityId(string?)
Declaration
protected abstract Task<int> ResolveEntityIdFromIdentityId(string? identityId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | identityId |
Returns
| Type | Description |
|---|---|
| Task<int> |
SetNormalizedEmailAsync(TUser, string?, CancellationToken)
Sets the normalized email for the specified user.
Declaration
public override Task SetNormalizedEmailAsync(TUser user, string? normalizedEmail, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose email address to set. |
| string | normalizedEmail | The normalized email to set for the specified |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The task object representing the asynchronous operation. |
SetNormalizedUserNameAsync(TUser, string?, CancellationToken)
Sets the given normalized name for the specified user.
Declaration
public override Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user whose name should be set. |
| string | normalizedName | The normalized name to set. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
SetPasswordHashAsync(TUser, string?, CancellationToken)
Sets the password hash for a user.
Declaration
public override Task SetPasswordHashAsync(TUser user, string? passwordHash, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TUser | user | The user to set the password hash for. |
| string | passwordHash | The password hash to set. |
| CancellationToken | cancellationToken | The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
| Type | Description |
|---|---|
| Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
TryConvertIdentityIdToInt(string?, out int)
Declaration
protected static bool TryConvertIdentityIdToInt(string? userId, out int intId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userId | |
| int | intId |
Returns
| Type | Description |
|---|---|
| bool |
UserIdToString(int)
Declaration
protected static string UserIdToString(int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | userId |
Returns
| Type | Description |
|---|---|
| string |