RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions> Class

Definition

The default implementation for IRemoteAuthenticationService<TRemoteAuthenticationState> that uses JS interop to authenticate the user.

generic <typename TRemoteAuthenticationState, typename TAccount, typename TProviderOptions>
 where TRemoteAuthenticationState : RemoteAuthenticationState where TAccount : RemoteUserAccount where TProviderOptions : gcnew()public ref class RemoteAuthenticationService : Microsoft::AspNetCore::Components::Authorization::AuthenticationStateProvider, Microsoft::AspNetCore::Components::WebAssembly::Authentication::IAccessTokenProvider, Microsoft::AspNetCore::Components::WebAssembly::Authentication::IRemoteAuthenticationService<TRemoteAuthenticationState>
public class RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions> : Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider, Microsoft.AspNetCore.Components.WebAssembly.Authentication.IAccessTokenProvider, Microsoft.AspNetCore.Components.WebAssembly.Authentication.IRemoteAuthenticationService<TRemoteAuthenticationState> where TRemoteAuthenticationState : RemoteAuthenticationState where TAccount : RemoteUserAccount where TProviderOptions : new()
type RemoteAuthenticationService<'RemoteAuthenticationState, 'Account, 'ProviderOptions (requires 'RemoteAuthenticationState :> RemoteAuthenticationState and 'Account :> RemoteUserAccount and 'ProviderOptions : (new : unit -> 'ProviderOptions))> = class
    inherit AuthenticationStateProvider
    interface IRemoteAuthenticationService<'RemoteAuthenticationState (requires 'RemoteAuthenticationState :> RemoteAuthenticationState)>
    interface IAccessTokenProvider
Public Class RemoteAuthenticationService(Of TRemoteAuthenticationState, TAccount, TProviderOptions)
Inherits AuthenticationStateProvider
Implements IAccessTokenProvider, IRemoteAuthenticationService(Of TRemoteAuthenticationState)

Type Parameters

TRemoteAuthenticationState

The state to preserve across authentication operations.

TAccount

The type of the RemoteUserAccount.

TProviderOptions

The options to be passed down to the underlying JavaScript library handling the authentication operations.

Inheritance
RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions>
Implements

Constructors

RemoteAuthenticationService<TRemoteAuthenticationState,TAccount, TProviderOptions>(IJSRuntime, IOptions<RemoteAuthenticationOptions<TProviderOptions>>, NavigationManager, AccountClaimsPrincipalFactory<TAccount>)

Initializes a new instance.

RemoteAuthenticationService<TRemoteAuthenticationState,TAccount, TProviderOptions>(IJSRuntime, IOptionsSnapshot<RemoteAuthenticationOptions<TProviderOptions>>, NavigationManager, AccountClaimsPrincipalFactory<TAccount>)
Obsolete.

Initializes a new instance.

RemoteAuthenticationService<TRemoteAuthenticationState,TAccount, TProviderOptions>(IJSRuntime, IOptionsSnapshot<RemoteAuthenticationOptions<TProviderOptions>>, NavigationManager, AccountClaimsPrincipalFactory<TAccount>, ILogger<RemoteAuthenticationService<TRemoteAuthenticationState, TAccount,TProviderOptions>>)

Initializes a new instance.

Properties

AccountClaimsPrincipalFactory

Gets the AccountClaimsPrincipalFactory<TAccount> to map accounts to ClaimsPrincipal.

JsRuntime

Gets the IJSRuntime to use for performing JavaScript interop operations.

Navigation

Gets the NavigationManager used to compute absolute urls.

Options

Gets the options for the underlying JavaScript library handling the authentication operations.

Methods

CompleteSignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

Completes the sign in operation for a user when it is performed outside of the application origin via a redirect operation followed by a redirect callback to a page in the application.

CompleteSignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

Completes the sign out operation for a user when it is performed outside of the application origin via a redirect operation followed by a redirect callback to a page in the application.

GetAuthenticatedUser()

Gets the current authenticated used using JavaScript interop.

GetAuthenticationStateAsync()

Asynchronously gets an AuthenticationState that describes the current user.

NotifyAuthenticationStateChanged(Task<AuthenticationState>)

Raises the AuthenticationStateChanged event.

(Inherited from AuthenticationStateProvider)
RequestAccessToken()

Tries to get an access token for the current user with the default set of permissions.

RequestAccessToken(AccessTokenRequestOptions)

Tries to get an access token with the options specified in AccessTokenRequestOptions.

SignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

Signs in a user.

SignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

Signs out a user.

Events

AuthenticationStateChanged

An event that provides notification when the AuthenticationState has changed. For example, this event may be raised if a user logs in or out.

(Inherited from AuthenticationStateProvider)

Applies to