Share via


RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions> 类

定义

使用 JS 互操作对用户进行身份验证的默认实现 IRemoteAuthenticationService<TRemoteAuthenticationState>

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)

类型参数

TRemoteAuthenticationState

要跨身份验证操作保留的状态。

TAccount

RemoteUserAccount 的类型。

TProviderOptions

要传递给处理身份验证操作的基础 JavaScript 库的选项。

继承
RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions>
实现

构造函数

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

初始化一个新实例。

RemoteAuthenticationService<TRemoteAuthenticationState,TAccount, TProviderOptions>(IJSRuntime, IOptionsSnapshot<RemoteAuthenticationOptions<TProviderOptions>>, NavigationManager, AccountClaimsPrincipalFactory<TAccount>)
已过时.

初始化一个新实例。

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

初始化一个新实例。

属性

AccountClaimsPrincipalFactory

获取用于 AccountClaimsPrincipalFactory<TAccount> 将帐户映射到 ClaimsPrincipal的 。

JsRuntime

获取 IJSRuntime 用于执行 JavaScript 互操作操作的 。

Navigation

获取 NavigationManager 用于计算绝对 URL 的 。

Options

获取处理身份验证操作的基础 JavaScript 库的选项。

方法

CompleteSignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

在应用程序源外部执行用户登录操作时,通过重定向操作,然后重定向到应用程序中的页面,完成该用户的登录操作。

CompleteSignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

当用户在应用程序源外部执行注销操作时,通过重定向操作,然后重定向回调到应用程序中的页面,完成注销操作。

GetAuthenticatedUser()

获取使用 JavaScript 互操作使用的当前经过身份验证的 。

GetAuthenticationStateAsync()

异步获取 AuthenticationState 描述当前用户的 。

NotifyAuthenticationStateChanged(Task<AuthenticationState>)

引发 AuthenticationStateChanged 事件。

(继承自 AuthenticationStateProvider)
RequestAccessToken()

尝试获取具有默认权限集的当前用户的访问令牌。

RequestAccessToken(AccessTokenRequestOptions)

尝试使用 中指定的 AccessTokenRequestOptions选项获取访问令牌。

SignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

让用户登录。

SignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

注销用户。

事件

AuthenticationStateChanged

一个事件,该事件在 已更改时 AuthenticationState 提供通知。 例如,如果用户登录或注销,可能会引发此事件。

(继承自 AuthenticationStateProvider)

适用于