Table of Contents

Class MsalKiotaAuthProvider

Namespace
OneImlx.Terminal.Authentication.Msal
Assembly
OneImlx.Terminal.Authentication.dll

The OneImlx terminal Kiota authentication and authorization provider for MSAL identity platform.

public sealed class MsalKiotaAuthProvider : IAuthenticationProvider, IAccessTokenProvider
Inheritance
MsalKiotaAuthProvider
Implements
IAuthenticationProvider
IAccessTokenProvider
Inherited Members

Constructors

MsalKiotaAuthProvider(TerminalOptions, IMsalTokenAcquisition, ILogger<MsalKiotaAuthProvider>)

Initializes a new instance.

public MsalKiotaAuthProvider(TerminalOptions terminalOptions, IMsalTokenAcquisition msalTokenAcquisition, ILogger<MsalKiotaAuthProvider> logger)

Parameters

terminalOptions TerminalOptions

The terminal options.

msalTokenAcquisition IMsalTokenAcquisition

The MSAL token acquisition.

logger ILogger<MsalKiotaAuthProvider>

The logger.

Properties

AllowedHostsValidator

Gets the validator that ensures the authorization request is for an allowed host.

public AllowedHostsValidator AllowedHostsValidator { get; }

Property Value

AllowedHostsValidator

Methods

AuthenticateRequestAsync(RequestInformation, Dictionary<string, object>?, CancellationToken)

Authenticates an HTTP request by acquiring an access token and setting it in the request's Authorization header.

public Task AuthenticateRequestAsync(RequestInformation request, Dictionary<string, object>? additionalAuthenticationContext = null, CancellationToken cancellationToken = default)

Parameters

request RequestInformation

The HTTP request to authenticate.

additionalAuthenticationContext Dictionary<string, object>

Optional. Additional authentication context that may contain extra scopes or other information.

cancellationToken CancellationToken

Optional. The cancellation token to cancel the asynchronous operation.

Returns

Task

Remarks

This method supports additional scopes provided either as an IEnumerable<T> or a single string with scopes separated by spaces. The scopes are expected to be provided in the additionalAuthenticationContext dictionary with the key scopes.

Exceptions

TerminalException

Thrown if the URI is not allowed by the AllowedHostsValidator or if token acquisition fails.

GetAuthorizationTokenAsync(Uri, Dictionary<string, object>?, CancellationToken)

Asynchronously gets an authorization token for the specified URI.

public Task<string> GetAuthorizationTokenAsync(Uri uri, Dictionary<string, object>? additionalAuthenticationContext = null, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI for which the authorization token is required.

additionalAuthenticationContext Dictionary<string, object>

Optional. Additional authentication context that may contain extra scopes or other information.

cancellationToken CancellationToken

Optional. The cancellation token to cancel the asynchronous operation.

Returns

Task<string>

A task that represents the asynchronous operation, containing the authorization token.

Remarks

This method supports additional scopes provided either as an IEnumerable<T> or a single string with scopes separated by spaces. The scopes are expected to be provided in the additionalAuthenticationContext dictionary with the key scopes.

Exceptions

TerminalException

Thrown if the URI is not allowed by the AllowedHostsValidator.