fix: clock skew when using jwt profile

This commit is contained in:
Livio Amstutz 2020-12-21 21:04:07 +01:00
parent 27f3bc0f4a
commit b23f37f7eb

View file

@ -69,7 +69,11 @@ func CreateAccessToken(ctx context.Context, tokenRequest TokenRequest, accessTok
if err != nil {
return "", 0, err
}
validity = exp.Add(client.ClockSkew()).Sub(time.Now().UTC())
var clockSkew time.Duration
if client != nil {
clockSkew = client.ClockSkew()
}
validity = exp.Add(clockSkew).Sub(time.Now().UTC())
if accessTokenType == AccessTokenTypeJWT {
token, err = CreateJWT(ctx, creator.Issuer(), tokenRequest, exp, id, creator.Signer(), client, creator.Storage())
return