Share via


RemoteAuthenticationService<TRemoteAuthenticationState,TAccount,TProviderOptions> 類別

定義

使用 JS Interop 驗證使用者的預設實作 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 Interop 作業的 。

Navigation

NavigationManager取得用來計算絕對 URL 的 。

Options

取得處理驗證作業的基礎 JavaScript 程式庫選項。

方法

CompleteSignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

透過重新導向作業在應用程式原始來源之外執行時,完成使用者的登入作業,後面接著重新導向回呼至應用程式中的頁面。

CompleteSignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

透過重新導向作業在應用程式原始來源之外執行時,完成使用者的登出作業,後面接著重新導向回呼至應用程式中的頁面。

GetAuthenticatedUser()

取得使用 JavaScript Interop 進行目前驗證的 。

GetAuthenticationStateAsync()

以非同步方式取得 AuthenticationState 描述目前使用者的 。

NotifyAuthenticationStateChanged(Task<AuthenticationState>)

引發 AuthenticationStateChanged 事件。

(繼承來源 AuthenticationStateProvider)
RequestAccessToken()

嘗試取得目前使用者具有預設許可權集的存取權杖。

RequestAccessToken(AccessTokenRequestOptions)

嘗試使用 中指定的 AccessTokenRequestOptions 選項來取得存取權杖。

SignInAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

登入使用者。

SignOutAsync(RemoteAuthenticationContext<TRemoteAuthenticationState>)

登出使用者。

事件

AuthenticationStateChanged

事件,可在 變更時 AuthenticationState 提供通知。 例如,如果使用者登入或登出,可能會引發此事件。

(繼承來源 AuthenticationStateProvider)

適用於