UserClaimsPrincipalFactory<TUser, TRole> Class

Provides methods to create a claims principal for a given user.

Namespace
Microsoft.AspNetCore.Identity
Assemblies
  • Microsoft.AspNetCore.Identity

Syntax

public class UserClaimsPrincipalFactory<TUser, TRole> : IUserClaimsPrincipalFactory<TUser> where TUser : class where TRole : class
class Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory<TUser, TRole>

Constructors

UserClaimsPrincipalFactory(Microsoft.AspNetCore.Identity.UserManager<TUser>, Microsoft.AspNetCore.Identity.RoleManager<TRole>, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Builder.IdentityOptions>)

Initializes a new instance of the Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory`2 class.

Arguments:
public UserClaimsPrincipalFactory(UserManager<TUser> userManager, RoleManager<TRole> roleManager, IOptions<IdentityOptions> optionsAccessor)

Methods

CreateAsync(TUser)

Creates a System.Security.Claims.ClaimsPrincipal from an user asynchronously.

Arguments:user (TUser) – The user to create a System.Security.Claims.ClaimsPrincipal from.
Return type:System.Threading.Tasks.Task<System.Security.Claims.ClaimsPrincipal>
Returns:The System.Threading.Tasks.Task that represents the asynchronous creation operation, containing the created System.Security.Claims.ClaimsPrincipal.
public virtual Task<ClaimsPrincipal> CreateAsync(TUser user)

Properties

Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory<TUser, TRole>.Options

Gets the Microsoft.AspNetCore.Builder.IdentityOptions for this factory.

Return type:Microsoft.AspNetCore.Builder.IdentityOptions
Returns:The current Microsoft.AspNetCore.Builder.IdentityOptions for this factory instance.
public IdentityOptions Options { get; }
Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory<TUser, TRole>.RoleManager

Gets the Microsoft.AspNetCore.Identity.RoleManager`1 for this factory.

Return type:Microsoft.AspNetCore.Identity.RoleManager<TRole>
Returns:The current Microsoft.AspNetCore.Identity.RoleManager`1 for this factory instance.
public RoleManager<TRole> RoleManager { get; }
Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory<TUser, TRole>.UserManager

Gets the Microsoft.AspNetCore.Identity.UserManager`1 for this factory.

Return type:Microsoft.AspNetCore.Identity.UserManager<TUser>
Returns:The current Microsoft.AspNetCore.Identity.UserManager`1 for this factory instance.
public UserManager<TUser> UserManager { get; }