Skip to main content

ClaimUtils

Assembly: ServiceStack.Blazor.dll
View Source
Declaration
public static class ClaimUtils

Fields

AuthenticationType

View Source
Declaration
public const string AuthenticationType = "Server Authentication"

PermissionType

View Source
Declaration
public const string PermissionType = "perm"

Picture

View Source
Declaration
public const string Picture = "picture"

Admin

View Source
Declaration
public const string Admin = "Admin"

Methods

IsAuthenticated(Nullable<AuthenticationState>)

View Source
Declaration
public static bool IsAuthenticated(this AuthenticationState? state)
Returns

System.Boolean

Parameters
TypeName
System.Nullable<AuthenticationState>state

AuthenticatedUser(Nullable<AuthenticationState>)

View Source
Declaration
public static ClaimsPrincipal AuthenticatedUser(this AuthenticationState? state)
Returns

System.Security.Claims.ClaimsPrincipal

Parameters
TypeName
System.Nullable<AuthenticationState>state

AuthenticatedUser(ClaimsPrincipal)

View Source
Declaration
public static ClaimsPrincipal AuthenticatedUser(this ClaimsPrincipal principal)
Returns

System.Security.Claims.ClaimsPrincipal

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

IsAdmin(ClaimsPrincipal)

View Source
Declaration
public static bool IsAdmin(this ClaimsPrincipal principal)
Returns

System.Boolean

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

GetUserId(ClaimsPrincipal)

View Source
Declaration
public static string GetUserId(this ClaimsPrincipal principal)
Returns

System.String

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

GetDisplayName(ClaimsPrincipal)

View Source
Declaration
public static string GetDisplayName(this ClaimsPrincipal principal)
Returns

System.String

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

GetEmail(ClaimsPrincipal)

View Source
Declaration
public static string GetEmail(this ClaimsPrincipal principal)
Returns

System.String

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

GetRoles(ClaimsPrincipal)

View Source
Declaration
public static string[] GetRoles(this ClaimsPrincipal principal)
Returns

System.String[]

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

GetPermissions(ClaimsPrincipal)

View Source
Declaration
public static string[] GetPermissions(this ClaimsPrincipal principal)
Returns

System.String[]

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal

HasRole(ClaimsPrincipal, String)

View Source
Declaration
public static bool HasRole(this ClaimsPrincipal principal, string roleName)
Returns

System.Boolean

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal
System.StringroleName

HasAllRoles(ClaimsPrincipal, String[])

View Source
Declaration
public static bool HasAllRoles(this ClaimsPrincipal principal, params string[] roleNames)
Returns

System.Boolean

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal
System.String[]roleNames

GetProfileUrl(ClaimsPrincipal)

View Source
Declaration
public static string GetProfileUrl(this ClaimsPrincipal principal)
Returns

System.String

Parameters
TypeName
System.Security.Claims.ClaimsPrincipalprincipal