共用方式為


AuthenticationManager.Authenticate(String, WebRequest, ICredentials) 方法

定義

警告

The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.

呼叫每個已註冊的驗證模組,找出第一個可以回應驗證要求的模組。

public:
 static System::Net::Authorization ^ Authenticate(System::String ^ challenge, System::Net::WebRequest ^ request, System::Net::ICredentials ^ credentials);
[System.Obsolete("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0009", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Net.Authorization? Authenticate (string challenge, System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization? Authenticate (string challenge, System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization Authenticate (string challenge, System.Net.WebRequest request, System.Net.ICredentials credentials);
[<System.Obsolete("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0009", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Authenticate : string * System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
static member Authenticate : string * System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
Public Shared Function Authenticate (challenge As String, request As WebRequest, credentials As ICredentials) As Authorization

參數

challenge
String

要求,由網際網路資源所傳回。

request
WebRequest

起始驗證挑戰的要求。

credentials
ICredentials

與此要求相關聯的認證。

傳回

Authorization 類別的執行個體,含有授權嘗試的結果。 如果沒有驗證模組回應要求,這個方法會傳回 null

屬性

例外狀況

僅限 .NET Core 與 .NET 5+:在所有情況下。

challengenull

-或-

requestnull

-或-

credentialsnull

備註

方法 Authenticate 會在每個已註冊的驗證模組上呼叫 IAuthenticationModule.Authenticate 方法,直到其中一個 Authorization 模塊回應實例為止。

傳回的第一個 Authorization 實例是用來驗證要求。 如果沒有驗證模組可以驗證要求,方法 Authenticate 會傳 null回 。

驗證模組會依向 註冊的順序呼叫 AuthenticationManager

適用於