Class PrincipalExtensions
- Namespace
- Duende.IdentityServer.Extensions
- Assembly
- Duende.IdentityServer.dll
Extension methods for IPrincipal and IIdentity .
public static class PrincipalExtensions
- Inheritance
-
PrincipalExtensions
- Inherited Members
Methods
GetAuthenticationMethod(IIdentity)
Gets the authentication method.
public static string GetAuthenticationMethod(this IIdentity identity)
Parameters
identityIIdentityThe identity.
Returns
Exceptions
- InvalidOperationException
amr claim is missing
GetAuthenticationMethod(IPrincipal)
Gets the authentication method.
public static string GetAuthenticationMethod(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetAuthenticationMethods(IIdentity)
Gets the authentication method claims.
public static IEnumerable<Claim> GetAuthenticationMethods(this IIdentity identity)
Parameters
identityIIdentityThe identity.
Returns
GetAuthenticationMethods(IPrincipal)
Gets the authentication method claims.
public static IEnumerable<Claim> GetAuthenticationMethods(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetAuthenticationTime(IPrincipal)
Gets the authentication time.
public static DateTime GetAuthenticationTime(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetAuthenticationTimeEpoch(IIdentity)
Gets the authentication epoch time.
public static long GetAuthenticationTimeEpoch(this IIdentity identity)
Parameters
identityIIdentityThe identity.
Returns
GetAuthenticationTimeEpoch(IPrincipal)
Gets the authentication epoch time.
public static long GetAuthenticationTimeEpoch(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetDisplayName(ClaimsPrincipal)
Gets the name.
public static string GetDisplayName(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe principal.
Returns
GetIdentityProvider(IIdentity)
Gets the identity provider.
public static string GetIdentityProvider(this IIdentity identity)
Parameters
identityIIdentityThe identity.
Returns
Exceptions
- InvalidOperationException
idp claim is missing
GetIdentityProvider(IPrincipal)
Gets the identity provider.
public static string GetIdentityProvider(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetSubjectId(IIdentity)
Gets the subject identifier.
public static string GetSubjectId(this IIdentity identity)
Parameters
identityIIdentityThe identity.
Returns
Exceptions
- InvalidOperationException
sub claim is missing
GetSubjectId(IPrincipal)
Gets the subject identifier.
public static string GetSubjectId(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
GetTenant(ClaimsPrincipal)
Gets the tenant.
public static string GetTenant(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe principal.
Returns
IsAuthenticated(IPrincipal)
Determines whether this instance is authenticated.
public static bool IsAuthenticated(this IPrincipal principal)
Parameters
principalIPrincipalThe principal.
Returns
- bool
trueif the specified principal is authenticated; otherwise,false.