docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License

    • Unity.DigitalTwins.Identity
      • AuthenticationState
      • BrowserAuthenticatedAccessTokenProvider
      • CommandLineAccessTokenProvider
      • DeviceToken
      • HttpPkceRequestHandler
      • IActivatePlatformSupport
      • IAuthenticator
      • IInteractiveAuthenticator
      • IPkceConfigurationProvider
      • IPkcePlatformSupport
      • IPkceRequestHandler
      • IPreAuthenticatedAccessTokenProvider
      • IUserInfoProvider
      • LaunchArgumentsParser
      • LicenseInfo
      • LicenseType
      • OrganizationInfo
      • PersonalAccessTokenProvider
      • PkceAuthenticator
      • PkceConfiguration
      • PkceConfigurationProvider
      • PreAuthenticatedHostAccessTokenProvider
      • UserInfo
      • UserInfoProvider
    • Unity.DigitalTwins.Identity.Runtime
      • AndroidActivatePlatformSupport
      • AndroidPkcePlatformSupport
      • CompositeAuthenticator
      • EditorActivateFromUrl
      • EditorActivatePlatformSupport
      • EditorPkcePlatformSupport
      • IosActivatePlatformSupport
      • IosPkcePlatformSupport
      • LinuxActivatePlatformSupport
      • LinuxPkcePlatformSupport
      • OsxActivatePlatformSupport
      • OsxPkcePlatformSupport
      • PlatformSupportFactory
      • WebglActivatePlatformSupport
      • WebglPkcePlatformSupport
      • WindowsActivatePlatformSupport
      • WindowsPkcePlatformSupport

    Class PkceAuthenticator

    An IAuthenticator implementation that provides authentication through PKCE (Proof Key Code Exchange) standards.

    Inheritance
    Object
    PkceAuthenticator
    Implements
    IAuthenticator
    Unity.DigitalTwins.Common.IAccessTokenProvider
    IDisposable
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.DigitalTwins.Identity
    Assembly: solution.dll
    Syntax
    public class PkceAuthenticator : IAuthenticator, IAccessTokenProvider, IDisposable

    Constructors

    PkceAuthenticator(IPkcePlatformSupport, IHttpClient, IAppIdProvider, IAppNameProvider, IUrlRedirectionInterceptor)

    Builds a PkceAuthenticator that uses the standard Proof Key Code Exchange (PKCE) authentication flow using built-in PkceRequestHandler and PkceConfigurationProvider.

    Declaration
    public PkceAuthenticator(IPkcePlatformSupport pkcePlatformSupport, IHttpClient httpClient, IAppIdProvider appIdProvider, IAppNameProvider appNameProvider, IUrlRedirectionInterceptor urlRedirectionInterceptor)
    Parameters
    Type Name Description
    IPkcePlatformSupport pkcePlatformSupport

    An IPkcePlatformSupport required to handle platform-specific features in the authentication flow.

    Unity.DigitalTwins.Common.IHttpClient httpClient

    An IHttpClient to reach cloud endpoints in the authentication flow.

    Unity.DigitalTwins.Common.IAppIdProvider appIdProvider

    An IAppIdProvider to inject the app identifier required on App settings cloud endpoints.

    Unity.DigitalTwins.Common.IAppNameProvider appNameProvider

    An IAppNameProvider to build the unique uri scheme used to bind the app to the browser response in a login operation.

    Unity.DigitalTwins.Common.IUrlRedirectionInterceptor urlRedirectionInterceptor

    PkceAuthenticator(IPkcePlatformSupport, IPkceRequestHandler, IPkceConfigurationProvider, IUrlRedirectionInterceptor)

    Builds a PkceAuthenticator that uses the standard Proof Key Code Exchange (PKCE) authentication flow using custom IPkceRequestHandler and IPkceConfigurationProvider.

    Declaration
    public PkceAuthenticator(IPkcePlatformSupport pkcePlatformSupport, IPkceRequestHandler pkceRequestHandler, IPkceConfigurationProvider pkceConfigurationProvider, IUrlRedirectionInterceptor urlRedirectionInterceptor)
    Parameters
    Type Name Description
    IPkcePlatformSupport pkcePlatformSupport

    An IPkcePlatformSupport required to handle platform-specific features in the authentication flow.

    IPkceRequestHandler pkceRequestHandler

    An IPkceRequestHandler to customize http requests used in the authentication flow.

    IPkceConfigurationProvider pkceConfigurationProvider

    An alternate IPkceConfigurationProvider to override the built-in one.

    Unity.DigitalTwins.Common.IUrlRedirectionInterceptor urlRedirectionInterceptor

    Properties

    AuthenticationState

    Holds the current AuthenticationState.

    Declaration
    public AuthenticationState AuthenticationState { get; }
    Property Value
    Type Description
    AuthenticationState

    Methods

    Dispose()

    Ensure disposal of any IDisposable references.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Ensure internal disposal of any IDisposable references.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing

    Dispose pattern boolean value received from public Dispose method.

    GetAccessTokenAsync()

    Awaitable call to fetch the user access token.

    Declaration
    public Task<string> GetAccessTokenAsync()
    Returns
    Type Description
    Task<String>

    A Task that results in the string value of the user access token when completed.

    InitializeAsync()

    Initializes the PkceAuthenticator and its resulting AuthenticationState from Interface implementation and initial configuration.

    Declaration
    public async Task InitializeAsync()
    Returns
    Type Description
    Task

    A Task.

    LoginAsync()

    Performs a Login operation.

    Declaration
    public async Task LoginAsync()
    Returns
    Type Description
    Task

    A Task.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if PkceAuthenticator was not properly initialized or if AuthenticationState is not loggedOut.

    Unity.DigitalTwins.Common.AuthenticationFailedException

    LogoutAsync()

    Performs a Logout operation.

    Declaration
    public async Task LogoutAsync()
    Returns
    Type Description
    Task

    A Task.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if PkceAuthenticator was not properly initialized or if AuthenticationState value is not LoggedIn.

    Events

    AuthenticationStateChanged

    Triggered when AuthenticationState of current user changes.

    Declaration
    public event Action<AuthenticationState> AuthenticationStateChanged
    Event Type
    Type Description
    Action<AuthenticationState>
    Remarks

    Listeners of the AuthenticationStateChanged event are responsible for restricting or allowing access to any available resources and features based on the returned value.

    Implements

    IAuthenticator
    Unity.DigitalTwins.Common.IAccessTokenProvider
    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023