AuthenticationTokenExtensions.GetTokenAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
GetTokenAsync(AuthenticationManager, String) | |
GetTokenAsync(IAuthenticationService, HttpContext, String) |
Authenticates the request using the specified authentication scheme and returns the value for the token. |
GetTokenAsync(AuthenticationManager, String, String) | |
GetTokenAsync(IAuthenticationService, HttpContext, String, String) |
Authenticates the request using the specified authentication scheme and returns the value for the token. |
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Http::Authentication::AuthenticationManager ^ manager, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.Authentication.AuthenticationManager manager, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Http.Authentication.AuthenticationManager * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (manager As AuthenticationManager, tokenName As String) As Task(Of String)
Parameters
- manager
- AuthenticationManager
- tokenName
- String
Returns
Applies to
ASP.NET Core 1.1 and ASP.NET Core 1.0
Product | Versions |
---|---|
ASP.NET Core | 1.0, 1.1 |
- Source:
- TokenExtensions.cs
- Source:
- TokenExtensions.cs
- Source:
- TokenExtensions.cs
Authenticates the request using the specified authentication scheme and returns the value for the token.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Authentication::IAuthenticationService ^ auth, Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Authentication.IAuthenticationService * Microsoft.AspNetCore.Http.HttpContext * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (auth As IAuthenticationService, context As HttpContext, tokenName As String) As Task(Of String)
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 and other versions
Product | Versions |
---|---|
ASP.NET Core | 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Http::Authentication::AuthenticationManager ^ manager, System::String ^ signInScheme, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.Authentication.AuthenticationManager manager, string signInScheme, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Http.Authentication.AuthenticationManager * string * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (manager As AuthenticationManager, signInScheme As String, tokenName As String) As Task(Of String)
Parameters
- manager
- AuthenticationManager
- signInScheme
- String
- tokenName
- String
Returns
Applies to
ASP.NET Core 1.1 and ASP.NET Core 1.0
Product | Versions |
---|---|
ASP.NET Core | 1.0, 1.1 |
- Source:
- TokenExtensions.cs
- Source:
- TokenExtensions.cs
- Source:
- TokenExtensions.cs
Authenticates the request using the specified authentication scheme and returns the value for the token.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::String ^> ^ GetTokenAsync(Microsoft::AspNetCore::Authentication::IAuthenticationService ^ auth, Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ scheme, System::String ^ tokenName);
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string scheme, string tokenName);
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string? scheme, string tokenName);
static member GetTokenAsync : Microsoft.AspNetCore.Authentication.IAuthenticationService * Microsoft.AspNetCore.Http.HttpContext * string * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetTokenAsync (auth As IAuthenticationService, context As HttpContext, scheme As String, tokenName As String) As Task(Of String)
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 and other versions
Product | Versions |
---|---|
ASP.NET Core | 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |