Class IdentityExtensions
Provides extension methods for principal objects to retrieve The Identity Hub provided claims.
Inheritance
Inherited Members
Namespace: TheIdentityHub
Assembly: TheIdentityHub.dll
Syntax
public static class IdentityExtensions
Methods
AccessToken(IPrincipal)
Gets an OAuth 2.0 Access Token for the specified principal, that can be used to call The Identity Hub API to get more information about the identity.
Declaration
public static string AccessToken(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The an OAuth 2.0 Access Token for the specified principal, that can be used to call The Identity Hub API to get more information about the identity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
AuthenticationStrength(IPrincipal)
The authentication strength of the authentication method used by the user to authenticate.
Declaration
public static AuthenticationStrength AuthenticationStrength(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
AuthenticationStrength |
DisplayName(IPrincipal)
Gets the display name for the specified principal.
Declaration
public static string DisplayName(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The display name for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
EmailAddress(IPrincipal)
Gets the e-mail address of the specified principal.
Declaration
public static string EmailAddress(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The e-mail address of the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
EmailAddresses(IPrincipal)
Gets the e-mail addresses for the specified principal.
Declaration
public static string[] EmailAddresses(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The e-mail addresses for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
ExpiresOn(IPrincipal)
The date and time the identity authentication expires if available.
Declaration
public static DateTime? ExpiresOn(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | The date and time the identity authentication expires if available. |
IdentityId(IPrincipal)
The id of the identity (unique).
Declaration
public static long IdentityId(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.Int64 | The identity id. |
IsApp(IPrincipal)
Determines whether this instance is an application.
Declaration
public static bool IsApp(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsIdentified(IPrincipal)
Determines whether this instance is identified.
Declaration
public static bool IsIdentified(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.Boolean |
|
LargePicture(IPrincipal)
Gets the url of a large identity picture for the specified principal.
Declaration
public static string LargePicture(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The url of a large identity picture for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
LargePictures(IPrincipal)
Gets the url of the large identity pictures for the specified principal.
Declaration
public static string[] LargePictures(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The url of the large identity pictures for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
MediumPicture(IPrincipal)
Gets the url of a medium identity picture for the specified principal.
Declaration
public static string MediumPicture(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The url of a medium identity picture for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
MediumPictures(IPrincipal)
Gets the url of the medium identity pictures for the specified principal.
Declaration
public static string[] MediumPictures(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The url of the medium identity pictures for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
Name(IPrincipal)
Gets the unique identifier for the specified principal.
Declaration
public static string Name(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The unique identifier for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
Roles(IPrincipal)
Gets the roles of the specified principal.
Declaration
public static string[] Roles(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The name of the roles for the specified principal. |
Scopes(IPrincipal)
Gets the scopes of the specified principal.
Declaration
public static string[] Scopes(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The name of the scopes for the specified principal. |
SmallPicture(IPrincipal)
Gets the url of a small identity picture for the specified principal.
Declaration
public static string SmallPicture(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String | The url of a small identity picture for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |
SmallPictures(IPrincipal)
Gets the url of the small identity pictures for the specified principal.
Declaration
public static string[] SmallPictures(this IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
System.String[] | The url of the small identity pictures for the specified principal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The principal is null. |