Show / Hide Table of Contents

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
System.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
System.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, Nullable<IList<Claim>>, Nullable<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
System.String clientID

The client ID.

System.String audience

The audience.

System.String subject

The subject.

System.String scope

The scope.

System.Nullable<IList<System.Security.Claims.Claim>> claims

The claims.

System.Nullable<DateTime> utcJwtExpiresAt

The UTC date/time when the JWT expires.

Returns
Type Description
Task<System.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<Microsoft.AspNetCore.Mvc.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<Microsoft.AspNetCore.Mvc.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<System.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<Microsoft.AspNetCore.Mvc.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<Microsoft.AspNetCore.Mvc.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<Microsoft.AspNetCore.Mvc.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
System.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
System.String errorCode

The error code.

System.String errorDescription

The error description.

System.String errorUri

The error page URI.

System.String correlationID

The correlation ID identifying the authentication request to respond to.

Returns
Type Description
Task<Microsoft.AspNetCore.Mvc.IActionResult>

A task that represents the operation and returns the action result.

Exceptions
Type Condition
OpenIDException

Thrown when the operation fails.

SendAuthnResponseAsync(String, Nullable<IEnumerable<Claim>>, String, String, Nullable<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
System.String subject

The subject identifier to include in the ID token.

System.Nullable<IEnumerable<System.Security.Claims.Claim>> claims

The claims to include in the ID token.

System.String accessToken

The access token.

System.String refreshToken

The refresh token.

System.Nullable<DateTime> utcAccessTokenExpiresAt

The UTC date/time when the access token expires.

System.String correlationID

The correlation ID identifying the authentication request to respond to.

Returns
Type Description
Task<Microsoft.AspNetCore.Mvc.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
System.String correlationID

The correlation ID identifying the logout request to respond to.

Returns
Type Description
Task<Microsoft.AspNetCore.Mvc.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
System.String

The error code.

Exceptions
Type Condition
OpenIDException

Thrown when the operation fails.

In This Article
Back to top Copyright © ComponentSpace Pty Ltd 2022. All rights reserved.