Add GetToken overload to HttpContext as well

This commit is contained in:
Hao Kung 2017-04-17 16:41:22 -07:00
parent 4b4b375909
commit d508c027ba
1 changed files with 9 additions and 0 deletions

View File

@ -180,5 +180,14 @@ namespace Microsoft.AspNetCore.Authentication
/// <returns>The value of the token.</returns>
public static Task<string> GetTokenAsync(this HttpContext context, string scheme, string tokenName) =>
context.RequestServices.GetRequiredService<IAuthenticationService>().GetTokenAsync(context, scheme, tokenName);
/// <summary>
/// Extension method for getting the value of an authentication token.
/// </summary>
/// <param name="context">The <see cref="HttpContext"/> context.</param>
/// <param name="tokenName">The name of the token.</param>
/// <returns>The value of the token.</returns>
public static Task<string> GetTokenAsync(this HttpContext context, string tokenName) =>
context.RequestServices.GetRequiredService<IAuthenticationService>().GetTokenAsync(context, tokenName);
}
}