SignInManager.CreateUserPrincipal(ISecurityUser, IEnumerable<Claim>) Method
Creates a ClaimsPrincipal object for the specified user.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
public ClaimsPrincipal CreateUserPrincipal(
ISecurityUser user,
IEnumerable<Claim> additionalClaims = null
)
Parameters
Name | Type | Description |
---|---|---|
user | ISecurityUser | An XAF Security System user. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
additionalClaims | IEnumerable<Claim> | null | A list of additional claims to add to the created ClaimsPrincipal. |
Returns
Type | Description |
---|---|
ClaimsPrincipal | A ClaimsPrincipal object that is a collection of statements (claims) about the specified user within the Security System. |
Remarks
The following code snippet demonstrates how to use the CreateUserPrincipal
method:
using DevExpress.ExpressApp.Security;
using Microsoft.Extensions.DependencyInjection;
// ...
// Use Dependency Injection to access the IServiceProvider.
var signInManager = serviceProvider.GetRequiredService<SignInManager>();
var principal = signInManager.CreateUserPrincipal(user);
See Also