From d508c027baa42180efa06f532c676b2fcbc058bf Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 17 Apr 2017 16:41:22 -0700 Subject: [PATCH] Add GetToken overload to HttpContext as well --- .../AuthenticationHttpContextExtensions.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationHttpContextExtensions.cs b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationHttpContextExtensions.cs index 8f159eb279..238251a60d 100644 --- a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationHttpContextExtensions.cs +++ b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationHttpContextExtensions.cs @@ -180,5 +180,14 @@ namespace Microsoft.AspNetCore.Authentication /// The value of the token. public static Task GetTokenAsync(this HttpContext context, string scheme, string tokenName) => context.RequestServices.GetRequiredService().GetTokenAsync(context, scheme, tokenName); + + /// + /// Extension method for getting the value of an authentication token. + /// + /// The context. + /// The name of the token. + /// The value of the token. + public static Task GetTokenAsync(this HttpContext context, string tokenName) => + context.RequestServices.GetRequiredService().GetTokenAsync(context, tokenName); } }