Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit d508c02

Browse files
committed
Add GetToken overload to HttpContext as well
1 parent 4b4b375 commit d508c02

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationHttpContextExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,14 @@ public static Task SignOutAsync(this HttpContext context, string scheme, Authent
180180
/// <returns>The value of the token.</returns>
181181
public static Task<string> GetTokenAsync(this HttpContext context, string scheme, string tokenName) =>
182182
context.RequestServices.GetRequiredService<IAuthenticationService>().GetTokenAsync(context, scheme, tokenName);
183+
184+
/// <summary>
185+
/// Extension method for getting the value of an authentication token.
186+
/// </summary>
187+
/// <param name="context">The <see cref="HttpContext"/> context.</param>
188+
/// <param name="tokenName">The name of the token.</param>
189+
/// <returns>The value of the token.</returns>
190+
public static Task<string> GetTokenAsync(this HttpContext context, string tokenName) =>
191+
context.RequestServices.GetRequiredService<IAuthenticationService>().GetTokenAsync(context, tokenName);
183192
}
184193
}

0 commit comments

Comments
 (0)