Skip to content

Commit 6ce86d9

Browse files
authored
Merge pull request #316 from cgostuff/v3
Increase nbf-leeway to 5 minutes
2 parents d42db69 + bd31461 commit 6ce86d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

oidc/verify.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDTok
274274
// If nbf claim is provided in token, ensure that it is indeed in the past.
275275
if token.NotBefore != nil {
276276
nbfTime := time.Time(*token.NotBefore)
277-
leeway := 1 * time.Minute
277+
// Set to 5 minutes since this is what other OpenID Connect providers do to deal with clock skew.
278+
// https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/6.12.2/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs#L149-L153
279+
leeway := 5 * time.Minute
278280

279281
if nowTime.Add(leeway).Before(nbfTime) {
280282
return nil, fmt.Errorf("oidc: current time %v before the nbf (not before) time: %v", nowTime, nbfTime)

0 commit comments

Comments
 (0)