Table of Contents

Class DefaultAuthTokenProvider

Namespace
anybill.POS.Client.Authentication
Assembly
anybill.POS.Client.dll

The default authentication token provider.

public class DefaultAuthTokenProvider : IAuthTokenProvider
Inheritance
DefaultAuthTokenProvider
Implements
Inherited Members

Constructors

DefaultAuthTokenProvider(IAnybillAuthenticationOptions)

Creates a new instance with minimum configuration.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

DefaultAuthTokenProvider(IAnybillAuthenticationOptions, ILogger<DefaultAuthTokenProvider>)

Creates a new instance.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions, ILogger<DefaultAuthTokenProvider> logger)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

logger ILogger<DefaultAuthTokenProvider>

The logger to use

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

DefaultAuthTokenProvider(IAnybillAuthenticationOptions, HttpClient, ILogger<DefaultAuthTokenProvider>)

Creates a new instance.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions, HttpClient httpClient, ILogger<DefaultAuthTokenProvider> logger)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

httpClient HttpClient

The http client to use.

logger ILogger<DefaultAuthTokenProvider>

The logger to use

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

DefaultAuthTokenProvider(IAnybillAuthenticationOptions, IDefaultAuthTokenProviderOptions, ILogger<DefaultAuthTokenProvider>)

Creates a new instance.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions, IDefaultAuthTokenProviderOptions defaultAuthTokenProviderOptions, ILogger<DefaultAuthTokenProvider> logger)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

defaultAuthTokenProviderOptions IDefaultAuthTokenProviderOptions

The custom auth service options to use.

logger ILogger<DefaultAuthTokenProvider>

The logger to use

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

DefaultAuthTokenProvider(IAnybillAuthenticationOptions, IDefaultAuthTokenProviderOptions, HttpClient, ILogger<DefaultAuthTokenProvider>)

Creates a new instance.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions, IDefaultAuthTokenProviderOptions defaultAuthTokenProviderOptions, HttpClient httpClient, ILogger<DefaultAuthTokenProvider> logger)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

defaultAuthTokenProviderOptions IDefaultAuthTokenProviderOptions

The custom auth service options to use.

httpClient HttpClient

The http client to use.

logger ILogger<DefaultAuthTokenProvider>

The logger to use

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

DefaultAuthTokenProvider(IAnybillAuthenticationOptions, IDefaultAuthTokenProviderOptions, IAnybillSerializer, HttpClient, ILogger<DefaultAuthTokenProvider>)

Creates a new instance.

public DefaultAuthTokenProvider(IAnybillAuthenticationOptions anybillAuthenticationOptions, IDefaultAuthTokenProviderOptions defaultAuthTokenProviderOptions, IAnybillSerializer anybillSerializer, HttpClient httpClient, ILogger<DefaultAuthTokenProvider> logger)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The authentication options to use.

defaultAuthTokenProviderOptions IDefaultAuthTokenProviderOptions

The custom auth service options to use.

anybillSerializer IAnybillSerializer

The IAnybillSerializer to use.

httpClient HttpClient

The http client to use.

logger ILogger<DefaultAuthTokenProvider>

The logger to use

Exceptions

ArgumentException

If anybillAuthenticationOptions is null.

Methods

GetAsync(bool, CancellationToken)

Returns an auth token.

public Task<string> GetAsync(bool reAuthenticate, CancellationToken cancellationToken)

Parameters

reAuthenticate bool

Whether to reset the state.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<string>

An auth token.

Remarks

Can be used to test authentication. Set reAuthenticate to reset the state.

Exceptions

AuthenticationException

If an error occured while authentication.

GetAsync(CancellationToken)

Returns an auth token.

public Task<string> GetAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task<string>

An auth token.

Remarks

Can be used to test authentication.

Exceptions

AuthenticationException

If an error occured while authentication.

SetAnybillAuthenticationOptions(IAnybillAuthenticationOptions)

Updates the current authentication options.

public void SetAnybillAuthenticationOptions(IAnybillAuthenticationOptions anybillAuthenticationOptions)

Parameters

anybillAuthenticationOptions IAnybillAuthenticationOptions

The updated authentication options to use.

Remarks

Resets the current cached authentication token.

UseCustomSerializer(IAnybillSerializer)

Use a custom serializer.

public void UseCustomSerializer(IAnybillSerializer anybillSerializer)

Parameters

anybillSerializer IAnybillSerializer

The custom serializer.