身份模型是否具有针对密码资源所有者流的令牌自动刷新?

时间:2018-09-03 05:21:31

标签: .net-core identityserver4

在将RequestResourceOwnerPasswordAsync扩展用于TokenClient时,给定响应为refresh_tokenexpires_in的情况下,是否存在令牌高速缓存的默认内存内插值?

access_token期满(从缓存自动退出)后,令牌客户端可以使用刷新令牌来请求令牌。

还是我们必须推出自己的产品?

private async Task<string> GetToken(
    string clientId, string clientSecret, string username, string password)
{
    string tokenAddress = "https://api.example.com/oauth2/token";
    var tokenClient = new TokenClient(tokenAddress, clientId, clientSecret);
    var result = await tokenClient.RequestResourceOwnerPasswordAsync(username, password);

    // do we create a wrapper around the token client that will implement a cache and auto-refresh
    // so that the next call, with same arguments will return same result.AccessToken
    // if still within bounds of the TimeNow.AddSeconds(result.ExpiresIn) window

    return result.AccessToken;
}

0 个答案:

没有答案
相关问题