Class UserClaimsPrincipalFactory<TUser, TRole, TPerson, TOrganisation>
Provides methods to create a claims principal for a given user, person and organisation.
Inheritance
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class UserClaimsPrincipalFactory<TUser, TRole, TPerson, TOrganisation> : UserClaimsPrincipalFactory<TUser, TRole, TPerson>, IUserClaimsPrincipalFactory<TUser> where TUser : class, IUser where TRole : class, IRole, new()
where TPerson : class, IPerson, IHaveClaims where TOrganisation : class, IOrganisation, 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. |
TOrganisation
The type used to represent an organisation. |
Constructors
UserClaimsPrincipalFactory(UserManager<TUser>, RoleManager<TRole>, PersonManager<TPerson>, OrganisationManager<TOrganisation>, IOptions<ExtendedIdentityOptions>, ILogger<UserClaimsPrincipalFactory<TUser, TRole>>, IUserPictureProvider)
Initializes a new instance of the UserClaimsPrincipalFactory<TUser, TRole, TPerson, TOrganisation> class.
Declaration
public UserClaimsPrincipalFactory(UserManager<TUser> userManager, RoleManager<TRole> roleManager, PersonManager<TPerson> personManager, OrganisationManager<TOrganisation> organisationManager, 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 retrieve person information from. |
OrganisationManager<TOrganisation>
organisationManager
The OrganisationManager<TOrganisation> to retrieve organisation 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, an associated person and on organisation 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. |