AuthenticationHttpContextExtensions.GetTokenAsync 方法

定义

重载

GetTokenAsync(HttpContext, String)

使用默认身份验证方案对请求进行身份验证,并返回令牌的值。 可以使用 配置 DefaultAuthenticateScheme默认身份验证方案。

GetTokenAsync(HttpContext, String, String)

使用指定的方案对请求进行身份验证,并返回令牌的值。

GetTokenAsync(HttpContext, String)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

使用默认身份验证方案对请求进行身份验证,并返回令牌的值。 可以使用 配置 DefaultAuthenticateScheme默认身份验证方案。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Http.HttpContext * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (context As HttpContext, tokenName As String) As Task(Of String)

参数

context
HttpContext

上下文 HttpContext

tokenName
String

令牌的名称。

返回

令牌的值(如果存在)。

适用于

GetTokenAsync(HttpContext, String, String)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

使用指定的方案对请求进行身份验证,并返回令牌的值。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ scheme, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string scheme, string tokenName);
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string? scheme, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Http.HttpContext * string * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (context As HttpContext, scheme As String, tokenName As String) As Task(Of String)

参数

context
HttpContext

上下文 HttpContext

scheme
String

身份验证方案的名称。

tokenName
String

令牌的名称。

返回

令牌的值(如果存在)。

适用于