อ่านในภาษาอังกฤษ

แชร์ผ่าน


AuthenticationHttpContextExtensions.GetTokenAsync Method

Definition

Overloads

GetTokenAsync(HttpContext, String)

Authenticates the request using the default authentication scheme and returns the value for the token. The default authentication scheme can be configured using DefaultAuthenticateScheme.

GetTokenAsync(HttpContext, String, String)

Authenticates the request using the specified scheme and returns the value for the token.

GetTokenAsync(HttpContext, String)

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

Authenticates the request using the default authentication scheme and returns the value for the token. The default authentication scheme can be configured using DefaultAuthenticateScheme.

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
C#
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string tokenName);

Parameters

context
HttpContext

The HttpContext context.

tokenName
String

The name of the token.

Returns

The value of the token if present.

Applies to

ASP.NET Core 9.0 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

GetTokenAsync(HttpContext, String, String)

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

Authenticates the request using the specified scheme and returns the value for the token.

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string scheme, string tokenName);
C#
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Http.HttpContext context, string? scheme, string tokenName);

Parameters

context
HttpContext

The HttpContext context.

scheme
String

The name of the authentication scheme.

tokenName
String

The name of the token.

Returns

The value of the token if present.

Applies to

ASP.NET Core 9.0 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0