Microsoft Docs只要有这个描述:
Defines whether the bearer token should be stored in the AuthenticationProperties after a successful authorization.
我想知道保存 JWT 是否允许您以某种方式撤销它,但我读到的每个关于 JWT 的地方都说它们是不可撤销的。您将如何处理存储在 AuthenticationProperties 中的 JWT?
最佳答案
将 JWT 存储在 AuthenticationProperties
中允许您从应用程序中的其他位置检索它。
例如,使用 GetTokenAsync
在 Action 内部,如下所示:
public async Task<IActionResult> SomeAction()
{
// using Microsoft.AspNetCore.Authentication;
var accessToken = await HttpContext.GetTokenAsync("access_token");
// ...
}
例如,如果您想在传出请求中转发 JWT,这非常有用。
关于c# - ASP.NET Core 2.0+ 中 JwtBearerOptions.SaveToken 属性的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57057749/