Class MsalPublicClientTokenAcquisition
- Namespace
- OneImlx.Terminal.Authentication.Msal
- Assembly
- OneImlx.Terminal.Authentication.dll
The default IMsalTokenAcquisition implementation using the IPublicClientApplication.
public class MsalPublicClientTokenAcquisition : IMsalTokenAcquisition
- Inheritance
-
MsalPublicClientTokenAcquisition
- Implements
- Inherited Members
Remarks
MsalPublicClientTokenAcquisition is responsible for handling token acquisition from the Microsoft Identity platform.
Constructors
MsalPublicClientTokenAcquisition(IPublicClientApplication, ILogger<MsalPublicClientTokenAcquisition>)
Initializes a new instance of the MsalPublicClientTokenAcquisition class. Requires an instance of IPublicClientApplication, which is the entry point for using MSAL, and a logger for logging activities and errors.
public MsalPublicClientTokenAcquisition(IPublicClientApplication publicClientApplication, ILogger<MsalPublicClientTokenAcquisition> logger)
Parameters
publicClientApplication
IPublicClientApplicationThe MSAL public client application instance.
logger
ILogger<MsalPublicClientTokenAcquisition>The logger to use for logging information and errors.
Methods
AcquireTokenInteractiveAsync(IEnumerable<string>)
Attempts to acquire a token interactively for the specified scopes.
public Task<AuthenticationResult> AcquireTokenInteractiveAsync(IEnumerable<string> scopes)
Parameters
scopes
IEnumerable<string>The scopes for which the token is requested.
Returns
- Task<AuthenticationResult>
A task representing the asynchronous operation and returning the authentication result.
AcquireTokenSilentAsync(IEnumerable<string>, IAccount)
Attempts to acquire a token silently for the specified scopes and account.
public Task<AuthenticationResult> AcquireTokenSilentAsync(IEnumerable<string> scopes, IAccount account)
Parameters
scopes
IEnumerable<string>The scopes for which the token is requested.
account
IAccountThe account for which the token is requested.
Returns
- Task<AuthenticationResult>
A task representing the asynchronous operation and returning the authentication result.
GetAccountsAsync(string?)
Returns all the available accounts in the user token cache for the application.
public Task<IEnumerable<IAccount>> GetAccountsAsync(string? userFlow = null)
Parameters
userFlow
string