Interface IOpenIDProvider
Provides OpenID Provider (OP) support for OpenID Connect (OIDC) authentication.
Namespace: ComponentSpace.OpenID
Assembly: ComponentSpace.OpenID.dll
Syntax
public interface IOpenIDProvider
Properties
ConfigurationName
Gets or sets the OpenID configuration name.
For most applications, a single OpenID configuration is used and the OpenID configuration name is not required. For multi-tenanted applications and other special use cases with multiple OpenID configurations, the name specifies the configuration to use.
Declaration
string? ConfigurationName { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The configuration name. |
Methods
ClearSessionAsync(string?)
Clears the current session state for the specified client or all clients.
Declaration
Task ClearSessionAsync(string? clientID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | clientID | The client ID. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the operation. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
CreateJwtAccessTokenAsync(string, string, string?, string?, IList<Claim>?, DateTime?)
Creates a JWT access token.
Declaration
Task<string> CreateJwtAccessTokenAsync(string clientID, string audience, string? subject = null, string? scope = null, IList<Claim>? claims = null, DateTime? utcJwtExpiresAt = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | clientID | The client ID. |
| string | audience | The audience. |
| string | subject | The subject. |
| string | scope | The scope. |
| IList<Claim> | claims | The claims. |
| DateTime? | utcJwtExpiresAt | The UTC date/time when the JWT expires. |
Returns
| Type | Description |
|---|---|
| Task<string> | A task that represents the operation and returns the JWT access token. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
GetKeysAsync()
Gets the OpenID provider's keys.
Declaration
Task<IActionResult> GetKeysAsync()
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
GetMetadataAsync()
Gets the OpenID provider's metadata.
Declaration
Task<IActionResult> GetMetadataAsync()
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
GetStatusAsync()
Gets the current OpenID session status.
Declaration
Task<IDictionary<string, IOpenIDStatus>> GetStatusAsync()
Returns
| Type | Description |
|---|---|
| Task<IDictionary<string, IOpenIDStatus>> | A task that represents the operation and returns the OpenID session status. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
GetTokensAsync(GetRefreshTokenResultAsync?, GetClientCredentialsResultAsync?, GetUserCredentialsResultAsync?)
Gets the tokens as part of the authorization code flow.
Declaration
Task<IActionResult> GetTokensAsync(GetRefreshTokenResultAsync? getRefreshTokenResult = null, GetClientCredentialsResultAsync? getClientCredentialsResult = null, GetUserCredentialsResultAsync? getUserCredentialsResult = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetRefreshTokenResultAsync | getRefreshTokenResult | The delegate that returns the refresh token result. |
| GetClientCredentialsResultAsync | getClientCredentialsResult | The delegate that returns the client credentials result. |
| GetUserCredentialsResultAsync | getUserCredentialsResult | The delegate that returns the user credentials result. |
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
GetUserInfoAsync()
Gets the user information.
Declaration
Task<IActionResult> GetUserInfoAsync()
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
IntrospectTokenAsync()
Introspects the token.
Declaration
Task<IActionResult> IntrospectTokenAsync()
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
ReceiveAuthnRequestAsync()
Receives the authentication request.
Declaration
Task<AuthenticationRequest> ReceiveAuthnRequestAsync()
Returns
| Type | Description |
|---|---|
| Task<AuthenticationRequest> | A task that represents the operation and returns the authentication request. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
ReceiveLogoutRequestAsync()
Receives the logout request.
Declaration
Task<LogoutRequest> ReceiveLogoutRequestAsync()
Returns
| Type | Description |
|---|---|
| Task<LogoutRequest> | A task that represents the operation and returns the logout request. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
RevokeAccessTokenAsync(string)
Revokes the access token.
Declaration
Task RevokeAccessTokenAsync(string accessToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | accessToken | The access token. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the operation. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
SendAuthnErrorResponseAsync(string, string?, string?, string?)
Sends the authentication error response.
Declaration
Task<IActionResult> SendAuthnErrorResponseAsync(string errorCode, string? errorDescription = null, string? errorUri = null, string? correlationID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | errorCode | The error code. |
| string | errorDescription | The error description. |
| string | errorUri | The error page URI. |
| string | correlationID | The correlation ID identifying the authentication request to respond to. |
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
SendAuthnResponseAsync(string, IEnumerable<Claim>?, string?, string?, DateTime?, string?)
Sends the authentication response.
Declaration
Task<IActionResult> SendAuthnResponseAsync(string subject, IEnumerable<Claim>? claims = null, string? accessToken = null, string? refreshToken = null, DateTime? utcAccessTokenExpiresAt = null, string? correlationID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subject | The subject identifier to include in the ID token. |
| IEnumerable<Claim> | claims | The claims to include in the ID token. |
| string | accessToken | The access token. |
| string | refreshToken | The refresh token. |
| DateTime? | utcAccessTokenExpiresAt | The UTC date/time when the access token expires. |
| string | correlationID | The correlation ID identifying the authentication request to respond to. |
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
SendLogoutResponseAsync(string?)
Sends the logout response.
Declaration
Task<IActionResult> SendLogoutResponseAsync(string? correlationID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | correlationID | The correlation ID identifying the logout request to respond to. |
Returns
| Type | Description |
|---|---|
| Task<IActionResult> | A task that represents the operation and returns the action result. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |
ToErrorCode(Exception)
Converts the exception to an error code.
Declaration
string ToErrorCode(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception. |
Returns
| Type | Description |
|---|---|
| string | The error code. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the operation fails. |