AuthenticationManager.PreAuthenticate(WebRequest, ICredentials) Metoda

Definicja

Przestroga

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

Wstępnie uwierzytelnia żądanie.

public:
 static System::Net::Authorization ^ PreAuthenticate(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? PreAuthenticate (System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization? PreAuthenticate (System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization PreAuthenticate (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 PreAuthenticate : System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
static member PreAuthenticate : System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
Public Shared Function PreAuthenticate (request As WebRequest, credentials As ICredentials) As Authorization

Parametry

request
WebRequest

Żądanie zasobu internetowego.

credentials
ICredentials

Poświadczenia skojarzone z żądaniem.

Zwraca

Wystąpienie Authorization klasy, jeśli żądanie może być wstępnie uwierzytelnione; w przeciwnym razie null. Jeśli credentials jest to null, ta metoda zwraca wartość null.

Atrybuty

Wyjątki

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

request to null.

Uwagi

Jeśli moduł uwierzytelniania może wstępnie uwierzytelniać żądanie, PreAuthenticate metoda zwraca wystąpienie uwierzytelniania i wysyła informacje autoryzacji do serwera z preemptively zamiast czekać na zasób w celu wystawienia wyzwania. To zachowanie zostało opisane w sekcji 3.3 RFC 2617 (Uwierzytelnianie HTTP: uwierzytelnianie podstawowe i szyfrowane dostępu). Moduły uwierzytelniania, które obsługują wstępne uwierzytelnianie, umożliwiają klientom zwiększenie wydajności serwera, unikając dodatkowych rund spowodowanych wyzwaniami uwierzytelniania.

Moduły autoryzacji, które mogą wstępnie uwierzytelniać żądania, ustawiają IAuthenticationModule.CanPreAuthenticate właściwość na true.

Dotyczy