Class UserClaimsPrincipalFactory<TUser, TRole, TPerson>
Provides methods to create a claims principal for a given user and person.
Inheritance
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class UserClaimsPrincipalFactory<TUser, TRole, TPerson> : UserClaimsPrincipalFactory<TUser, TRole>, IUserClaimsPrincipalFactory<TUser> where TUser : class, IUser where TRole : class, IRole, new()
where TPerson : class, IPerson, IHaveClaims
Type Parameters
TUser
The type used to represent a user. |
TRole
The type used to represent a role. |
TPerson
The type used to represent a person. |
Constructors
UserClaimsPrincipalFactory(UserManager<TUser>, RoleManager<TRole>, PersonManager<TPerson>, IOptions<ExtendedIdentityOptions>, ILogger<UserClaimsPrincipalFactory<TUser, TRole>>, IUserPictureProvider)
Initializes a new instance of the UserClaimsPrincipalFactory<TUser, TRole, TPerson> class.
Declaration
public UserClaimsPrincipalFactory(UserManager<TUser> userManager, RoleManager<TRole> roleManager, PersonManager<TPerson> personManager, IOptions<ExtendedIdentityOptions> optionsAccessor, ILogger<UserClaimsPrincipalFactory<TUser, TRole>> logger, IUserPictureProvider pictureProvider = null)
Parameters
UserManager<TUser>
userManager
The UserManager<TUser> to retrieve user information from. |
Microsoft.AspNetCore.Identity.RoleManager<TRole>
roleManager
The Microsoft.AspNetCore.Identity.RoleManager<TRole> to retrieve a user's roles from. |
PersonManager<TPerson>
personManager
The PersonManager<TPerson> to retriece person information from. |
Microsoft.Extensions.Options.IOptions<ExtendedIdentityOptions>
optionsAccessor
The configured ExtendedIdentityOptions. |
Microsoft.Extensions.Logging.ILogger<UserClaimsPrincipalFactory<TUser, TRole>>
logger
The logger used to log messages, warnings and errors. |
IUserPictureProvider
pictureProvider
The configured IUserPictureProvider used to create the picture claim (if any). |
Methods
CreateAsync(TUser)
Creates a System.Security.Claims.ClaimsPrincipal from an user and associated person asynchronously.
Declaration
public override async Task<ClaimsPrincipal> CreateAsync(TUser user)
Parameters
TUser
user
The user to create a System.Security.Claims.ClaimsPrincipal from. |
Returns
System.Threading.Tasks.Task<System.Security.Claims.ClaimsPrincipal>
The System.Threading.Tasks.Task that represents the asynchronous creation operation, containing the created System.Security.Claims.ClaimsPrincipal. |
Overrides
GetPerson(TUser)
Declaration
protected async Task<TPerson> GetPerson(TUser user)
Parameters
TUser
user
|
Returns
System.Threading.Tasks.Task<TPerson>
|
GetPictureClaimValue(TUser)
Gets a picture URL for a user.
Declaration
protected override async Task<string> GetPictureClaimValue(TUser user)
Parameters
TUser
user
The user to create a picture url for. |
Returns
System.Threading.Tasks.Task<String>
The url to a user picture, or null if the user doesn't have a picture. |