View Source
Class MemberUserStore
A custom user store that uses Umbraco member data.
Inheritance
object
UserStoreBase<
MemberIdentityUser,
string,
IdentityUserClaim<
string>,
IdentityUserLogin<
string>,
IdentityUserToken<
string>>
UserStoreBase<
MemberIdentityUser,
UmbracoIdentityRole,
string,
IdentityUserClaim<
string>,
IdentityUserRole<
string>,
IdentityUserLogin<
string>,
IdentityUserToken<
string>,
IdentityRoleClaim<
string>>
Assembly: Umbraco.Infrastructure.dll
Syntax
public class MemberUserStore : UmbracoUserStore<MemberIdentityUser, UmbracoIdentityRole>, IMemberUserStore
Constructors
View Source
MemberUserStore(IMemberService, IUmbracoMapper, ICoreScopeProvider, IdentityErrorDescriber, IExternalLoginWithKeyService, ITwoFactorLoginService, IPublishedMemberCache)
Initializes a new instance of the MemberUserStore class for the members identity store
Declaration
[Obsolete("Please use the constructor with all parameters. Scheduled for removal in Umbraco 19.")]
public MemberUserStore(IMemberService memberService, IUmbracoMapper mapper, ICoreScopeProvider scopeProvider, IdentityErrorDescriber describer, IExternalLoginWithKeyService externalLoginService, ITwoFactorLoginService twoFactorLoginService, IPublishedMemberCache memberCache)
Parameters
View Source
MemberUserStore(IMemberService, IUmbracoMapper, ICoreScopeProvider, IdentityErrorDescriber, IExternalLoginWithKeyService, ITwoFactorLoginService, IPublishedMemberCache, IExternalMemberService)
Initializes a new instance of the MemberUserStore class for the members identity store
Declaration
public MemberUserStore(IMemberService memberService, IUmbracoMapper mapper, ICoreScopeProvider scopeProvider, IdentityErrorDescriber describer, IExternalLoginWithKeyService externalLoginService, ITwoFactorLoginService twoFactorLoginService, IPublishedMemberCache memberCache, IExternalMemberService externalMemberService)
Parameters
Fields
View Source
CancelledIdentityErrorCode
Represents the error code used to indicate that an identity operation was canceled by the user store.
Declaration
public const string CancelledIdentityErrorCode = "CancelledIdentityErrorUserStore"
Field Value
Methods
View Source
AddLoginAsync(MemberIdentityUser, UserLoginInfo, CancellationToken)
Declaration
public override Task AddLoginAsync(MemberIdentityUser user, UserLoginInfo login, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
|
| UserLoginInfo |
login |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
CreateAsync(MemberIdentityUser, CancellationToken)
Declaration
public override Task<IdentityResult> CreateAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<IdentityResult> |
|
View Source
DeleteAsync(MemberIdentityUser, CancellationToken)
Declaration
public override Task<IdentityResult> DeleteAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<IdentityResult> |
|
View Source
FindByEmailAsync(string, CancellationToken)
Declaration
public override Task<MemberIdentityUser?> FindByEmailAsync(string email, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| string |
email |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
FindByNameAsync(string, CancellationToken)
Declaration
public override Task<MemberIdentityUser?> FindByNameAsync(string userName, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| string |
userName |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
FindRoleAsync(string, CancellationToken)
Declaration
protected override Task<UmbracoIdentityRole?> FindRoleAsync(string roleName, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
roleName |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
FindUserAsync(string, CancellationToken)
Declaration
protected override Task<MemberIdentityUser?> FindUserAsync(string userId, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
userId |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
FindUserLoginAsync(string, string, string, CancellationToken)
Declaration
protected override Task<IdentityUserLogin<string>?> FindUserLoginAsync(string userId, string loginProvider, string providerKey, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
userId |
|
| string |
loginProvider |
|
| string |
providerKey |
|
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<IdentityUserLogin<string>> |
|
View Source
FindUserLoginAsync(string, string, CancellationToken)
Declaration
protected override Task<IdentityUserLogin<string>?> FindUserLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
loginProvider |
|
| string |
providerKey |
|
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<IdentityUserLogin<string>> |
|
View Source
FindUserRoleAsync(string, string, CancellationToken)
Declaration
protected override Task<IdentityUserRole<string>?> FindUserRoleAsync(string userId, string roleId, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
userId |
|
| string |
roleId |
|
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<IdentityUserRole<string>> |
|
View Source
GetLoginsAsync(MemberIdentityUser, CancellationToken)
Declaration
public override Task<IList<UserLoginInfo>> GetLoginsAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<IList<UserLoginInfo>> |
|
View Source
GetPublishedMember(MemberIdentityUser?)
Declaration
public IPublishedContent? GetPublishedMember(MemberIdentityUser? user)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
The member identity user whose published member content is to be retrieved. If null, the method returns null.
|
Returns
View Source
GetRolesAsync(MemberIdentityUser, CancellationToken)
Gets a list of role names that the specified user belongs to.
Declaration
public override Task<IList<string>> GetRolesAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
The user whose roles are to be retrieved.
|
| CancellationToken |
cancellationToken |
A cancellation token that can be used to cancel the operation.
|
Returns
| Type |
Description |
| Task<IList<string>> |
A task that represents the asynchronous operation. The task result contains the list of role names the user belongs to.
|
View Source
GetTokenAsync(MemberIdentityUser, string, string, CancellationToken)
Overridden to support Umbraco's own data storage requirements
Declaration
public override Task<string?> GetTokenAsync(MemberIdentityUser user, string loginProvider, string name, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
|
| string |
loginProvider |
|
| string |
name |
|
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<string> |
|
View Source
GetTwoFactorEnabledAsync(MemberIdentityUser, CancellationToken)
Declaration
public override Task<bool> GetTwoFactorEnabledAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<bool> |
|
View Source
GetUsersInRoleAsync(string, CancellationToken)
Asynchronously retrieves all users assigned to the specified role as MemberIdentityUser objects.
Declaration
public override Task<IList<MemberIdentityUser>> GetUsersInRoleAsync(string roleName, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| string |
roleName |
The name of the role to list users for.
|
| CancellationToken |
cancellationToken |
A cancellation token that can be used to cancel the operation.
|
Returns
| Type |
Description |
| Task<IList<MemberIdentityUser>> |
A task that represents the asynchronous operation. The task result contains a list of MemberIdentityUser instances in the specified role.
|
View Source
IsInRoleAsync(MemberIdentityUser, string, CancellationToken)
Determines whether the specified user is a member of the given role.
Declaration
public override Task<bool> IsInRoleAsync(MemberIdentityUser user, string roleName, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
The user to check.
|
| string |
roleName |
The name of the role to check.
|
| CancellationToken |
cancellationToken |
A cancellation token to observe while waiting for the task to complete.
|
Returns
| Type |
Description |
| Task<bool> |
True if the user is in the specified role; otherwise, false.
|
View Source
RemoveLoginAsync(MemberIdentityUser, string, string, CancellationToken)
Declaration
public override Task RemoveLoginAsync(MemberIdentityUser user, string loginProvider, string providerKey, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
|
| string |
loginProvider |
|
| string |
providerKey |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
ResolveEntityIdFromIdentityId(string?)
Declaration
protected override Task<int> ResolveEntityIdFromIdentityId(string? identityId)
Parameters
| Type |
Name |
Description |
| string |
identityId |
|
Returns
| Type |
Description |
| Task<int> |
|
View Source
SetTokenAsync(MemberIdentityUser, string, string, string?, CancellationToken)
Overridden to support Umbraco's own data storage requirements
Declaration
public override Task SetTokenAsync(MemberIdentityUser user, string loginProvider, string name, string? value, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| MemberIdentityUser |
user |
|
| string |
loginProvider |
|
| string |
name |
|
| string |
value |
|
| CancellationToken |
cancellationToken |
|
Returns
View Source
UpdateAsync(MemberIdentityUser, CancellationToken)
Declaration
public override Task<IdentityResult> UpdateAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<IdentityResult> |
|