Class BrowserAuthenticatedAccessTokenProvider
An IAuthenticator implementation that expects an access token from a browser environment.
Inherited Members
Namespace: Unity.Cloud.Identity
Syntax
public class BrowserAuthenticatedAccessTokenProvider : IAuthenticator, IAccessTokenProvider, IAuthenticationStateProvider
Examples
Constructors
BrowserAuthenticatedAccessTokenProvider(IAuthenticationPlatformSupport, Dictionary<String, String>)
Returns an IAccessTokenProvider
implementation that expects an access token from a browser environment.
Declaration
public BrowserAuthenticatedAccessTokenProvider(IAuthenticationPlatformSupport authenticationPlatformSupport, Dictionary<string, string> localStorageKeyNames)
Parameters
Type | Name | Description |
---|---|---|
IAuthenticationPlatformSupport | authenticationPlatformSupport | The IAuthenticationPlatformSupport that handles IKeyValueStore used to cache the access token. |
Dictionary<String, String> | localStorageKeyNames | A dictionary with browser locations as keys and local storage key name as values. |
Remarks
The BrowserAuthenticatedAccessTokenProvider
tries to match running host location with location provided in
Properties
AuthenticationState
Holds the current AuthenticationState
.
Declaration
public AuthenticationState AuthenticationState { get; }
Property Value
Type | Description |
---|---|
AuthenticationState |
Implements
Methods
GetAccessTokenAsync()
Declaration
public async Task<string> GetAccessTokenAsync()
Returns
Type | Description |
---|---|
Task<String> |
Implements
HasValidPreconditionsAsync()
Indicates if the BrowserAuthenticatedAccessTokenProvider running instance has access to an access token from the browser environment.
Declaration
public Task<bool> HasValidPreconditionsAsync()
Returns
Type | Description |
---|---|
Task<Boolean> | If the BrowserAuthenticatedAccessTokenProvider running instance has access to an access token. |
Implements
InitializeAsync()
A task to initialize the AuthenticationState from either cache or direct injection value.
Declaration
public async Task InitializeAsync()
Returns
Type | Description |
---|---|
Task |
Implements
Events
AuthenticationStateChanged
Triggers when the AuthenticationState of the current user changes.
Declaration
public event Action<AuthenticationState> AuthenticationStateChanged
Event Type
Type | Description |
---|---|
Action<AuthenticationState> |
Implements
Remarks
Subscribers of this event should restrict or allow access to available resources and features based on the returned value.