SignInManager.CreateUserPrincipal(String) Method
Creates a ClaimsPrincipal object based on a user’s authentication token.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v25.1.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| userToken | String | A |
Returns
| Type | Description |
|---|---|
| DevExpress.ExpressApp.Security.AuthenticationResult | An object of the |
Remarks
Important
This overload of the CreateUserPrincipal method is not supported on the WinForms platform. If called from a WinForms application, it throws the PlatformNotSupportedException.
Use this method overload to create a ClaimsPrincipal object for a user based on the user’s login token. It returns an AuthenticationResult object that exposes the following properties:
Succeeded- A
booleanproperty that indicates whether or not the user was successfully resolved based on the token. Principal- If the operation succeeds, this property contains the ClaimsPrincipal object (a collection of statements about the authenticated user) returned by the Security System.
Error- If the operation fails, this property contains the resulting Exception.
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(userAuthenticationToken);