Interface IAuthenticator
An interface that provides calls to allow the user to login or logout. When logging in, the interface returns a token you can use to retrieve access to Digital Twin services.
Inherited Members
Unity.DigitalTwins.Common.IAccessTokenProvider.GetAccessTokenAsync()
Namespace: Unity.DigitalTwins.Identity
Assembly: solution.dll
Syntax
public interface IAuthenticator : IAccessTokenProvider
Properties
AuthenticationState
Holds the current AuthenticationState.
Declaration
AuthenticationState AuthenticationState { get; }
Property Value
| Type | Description |
|---|---|
| AuthenticationState |
Methods
InitializeAsync()
Initializes the IAuthenticator and its resulting AuthenticationState from the Interface implementation and initial configuration.
Declaration
Task InitializeAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task. |
LoginAsync()
Performs a login operation.
Declaration
Task LoginAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if IAuthenticator isn't properly initialized. |
| Unity.DigitalTwins.Common.AuthenticationFailedException |
LogoutAsync()
Performs a logout operation.
Declaration
Task LogoutAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if IAuthenticator isn't properly initialized. |
Events
AuthenticationStateChanged
Triggers when the AuthenticationState of the current user changes.
Declaration
event Action<AuthenticationState> AuthenticationStateChanged
Event Type
| Type | Description |
|---|---|
| Action<AuthenticationState> |
Remarks
Subscribers of this event should restrict or allow access to available resources and features based on the returned value.