Search Results for

    Show / Hide Table of Contents
    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>>
    UmbracoUserStore<MemberIdentityUser, UmbracoIdentityRole>
    Namespace: Umbraco.Cms.Core.Security
    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
    Type Name Description
    IMemberService memberService

    The member service

    IUmbracoMapper mapper

    The mapper for properties

    ICoreScopeProvider scopeProvider

    The scope provider

    IdentityErrorDescriber describer

    The error describer

    IExternalLoginWithKeyService externalLoginService

    The external login service

    ITwoFactorLoginService twoFactorLoginService

    The two factor login service

    IPublishedMemberCache memberCache

    The published member cache for resolving member content.

    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
    Type Name Description
    IMemberService memberService

    The member service

    IUmbracoMapper mapper

    The mapper for properties

    ICoreScopeProvider scopeProvider

    The scope provider

    IdentityErrorDescriber describer

    The error describer

    IExternalLoginWithKeyService externalLoginService

    The external login service

    ITwoFactorLoginService twoFactorLoginService

    The two factor login service

    IPublishedMemberCache memberCache

    The published member cache for resolving member content.

    IExternalMemberService externalMemberService

    The external member service for external-only members.

    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
    Type Description
    string

    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
    Type Description
    Task
    View Source

    CreateAsync(MemberIdentityUser, CancellationToken)

    Declaration
    public override Task<IdentityResult> CreateAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MemberIdentityUser user
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IdentityResult>
    View Source

    DeleteAsync(MemberIdentityUser, CancellationToken)

    Declaration
    public override Task<IdentityResult> DeleteAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MemberIdentityUser user
    CancellationToken cancellationToken
    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
    Type Description
    Task<MemberIdentityUser>
    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
    Type Description
    Task<MemberIdentityUser>
    View Source

    FindRoleAsync(string, CancellationToken)

    Declaration
    protected override Task<UmbracoIdentityRole?> FindRoleAsync(string roleName, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string roleName
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<UmbracoIdentityRole>
    View Source

    FindUserAsync(string, CancellationToken)

    Declaration
    protected override Task<MemberIdentityUser?> FindUserAsync(string userId, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string userId
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<MemberIdentityUser>
    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
    Type Name Description
    MemberIdentityUser user
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IList<UserLoginInfo>>
    View Source

    GetPublishedMember(MemberIdentityUser?)

    Retrieves the published member content associated with the specified 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
    Type Description
    IPublishedContent

    The IPublishedContent representing the published member content if found; otherwise, null.

    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.

    Remarks

    This method lazy loads the roles for the member.

    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>
    Remarks

    The base class's implementation of this calls into FindTokenAsync, RemoveUserTokenAsync and AddUserTokenAsync, both methods will only work with ORMs that are change tracking ORMs like EFCore.

    View Source

    GetTwoFactorEnabledAsync(MemberIdentityUser, CancellationToken)

    Declaration
    public override Task<bool> GetTwoFactorEnabledAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MemberIdentityUser user
    CancellationToken cancellationToken
    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
    Type Description
    Task
    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
    Type Description
    Task
    Remarks

    The base class's implementation of this calls into FindTokenAsync and AddUserTokenAsync, both methods will only work with ORMs that are change tracking ORMs like EFCore.

    View Source

    UpdateAsync(MemberIdentityUser, CancellationToken)

    Declaration
    public override Task<IdentityResult> UpdateAsync(MemberIdentityUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MemberIdentityUser user
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IdentityResult>
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX