Nucleus .Net Core CMS

Authorization.ClaimsPrincipalExtensions Class

Namespace: Nucleus.Extensions.Authorization
Assembly: Nucleus.Extensions.dll
Extensions used to access the current user's claims.

Methods

GetUserId (ClaimsPrincipal) Method

GetUserId (ClaimsPrincipal user)
Retrieve the name identifier claim from the user (claims principal)
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal
Remarks
The name identifier is the User Id from the Users table.

IsSystemAdministrator (ClaimsPrincipal) Method

IsSystemAdministrator (ClaimsPrincipal user)
Retrieve a true/false value indicating whether the user (claims principal) is a system administrator.
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal

IsSiteAdmin (ClaimsPrincipal,Site) Method

IsSiteAdmin (ClaimsPrincipal user, Site site)
Retrieve a true/false value indicating whether the user (claims principal) is a site administrator or system administrator.

IsAnonymous (ClaimsPrincipal) Method

IsAnonymous (ClaimsPrincipal user)
Retrieve a true/false value indicating whether the user (claims principal) is anonymous (not logged on).
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal

IsApproved (ClaimsPrincipal) Method

IsApproved (ClaimsPrincipal user)
Retrieve a true/false value indicating whether the user (claims principal) account has been approved.
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal

IsVerified (ClaimsPrincipal) Method

IsVerified (ClaimsPrincipal user)
Retrieve a true/false value indicating whether the user (claims principal) account has been verified.
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal

IsPasswordExpired (ClaimsPrincipal) Method

IsPasswordExpired (ClaimsPrincipal user)
Retrieve a true/false value indicating whether the user (claims principal) password has expired.
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal

GetUserClaim<T> (ClaimsPrincipal,String) Method

GetUserClaim<T> (ClaimsPrincipal user, String nameIdentifier)
Retrieve the specified claim from the user (claims principal)
Type Parameters
T Type to return.
Parameters
Name Type
user System.Security.Claims.ClaimsPrincipal
nameIdentifier String