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

Internet 资源返回的质询。

request
WebRequest

发起身份验证质询的请求。

credentials
ICredentials

与此请求关联的凭据。

返回

Authorization 类的实例,包含授权尝试的结果。 如果没有身份验证模块响应质询,则此方法返回 null

属性

例外

仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。

challengenull

requestnull

credentialsnull

注解

方法 Authenticate 在每个已注册的身份验证模块上调用 IAuthenticationModule.Authenticate 方法,直到其中一个 Authorization 模块使用 实例做出响应。

返回的第一个 Authorization 实例用于对请求进行身份验证。 如果任何身份验证模块都无法对请求进行身份验证,方法 Authenticatenull返回 。

身份验证模块按注册到 AuthenticationManager的顺序调用。

适用于