UserManager.GetUserName(IPrincipal) Method
Returns the value of the User Name claim from the specified claims principal.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
Parameters
Name | Type | Description |
---|---|---|
principal | IPrincipal | An object that implements the |
Returns
Type | Description |
---|---|
String | A |
Remarks
The following code snippet demonstrates how to use the GetUserName
method:
using DevExpress.ExpressApp.Security;
using Microsoft.Extensions.DependencyInjection;
// ...
// Use Dependency Injection to access the IServiceProvider.
var userManager = serviceProvider.GetRequiredService<UserManager>();
string userName = userManager.GetUserName(principal);
See Also