Table of Contents

Interface ILoginService

Namespace
Tenduke.Core.Auth
Assembly
Tenduke.Core.dll

Service for authenticating the user via OpenID Connect.

public interface ILoginService

Remarks

Implementations should implement a full authentication flow and retrieve an access token. The access token must include an OpenID Connect ID Token.

Examples of authentication flows would include Authorization Code Flow, Authorization Code Flow with Proof Key for Code Exchange, or Device Authorization Flow.

The built in implementations of this interface update the IAccessTokenStore with the retrieved TokenResponse before returning. This is necessary for the middleware handling the authentication of requests to the 10Duke Enterprise or Scale API, and is a requirement for any custom implementation of this type.

Properties

AccessTokenRepository

Stores the current access token for the user.

IAccessTokenRepository AccessTokenRepository { get; }

Property Value

IAccessTokenRepository

Methods

LoginAsync()

Authenticate the user via OpenID Connect, using the provided browser interface (if any).

Task<TokenResponse?> LoginAsync()

Returns

Task<TokenResponse>

The token response object with the access token, id token, and refresh token (if present).

Exceptions

HttpListenerException

HttpListener could be started for redirect callback URL, or the login failed.

AuthenticationException

Login failed.

LoginAsync(CancellationToken)

Authenticate the user via OpenID Connect, using the provided browser interface (if any).

Task<TokenResponse?> LoginAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task<TokenResponse>

The token response object with the access token, id token, and refresh token (if present).

Exceptions

HttpListenerException

HttpListener could be started for redirect callback URL, or the login failed.

ObjectDisposedException

The provided cancellation token was already disposed.

AuthenticationException

Login failed.

OperationCanceledException

The operation was canceled.

LogoutAsync()

Logout the user from the OpenID Provider session.

Task LogoutAsync()

Returns

Task

Remarks

The logout functionality is dependent upon the specific OpenID Provider in use. The required behavior must be configured during initialization of the SDK.

LogoutAsync(CancellationToken)

Logout the user from the OIDC Provider session.

Task LogoutAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task

Remarks

The logout functionality is dependent upon the specific OpenID Provider in use. The required behavior must be configured during initialization of the SDK.