Skip to content

Commit

Permalink
increased nbf-leeway to 5 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
cgostuff committed Oct 2, 2021
1 parent d42db69 commit bd31461
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oidc/verify.go
Expand Up @@ -274,7 +274,9 @@ func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDTok
// If nbf claim is provided in token, ensure that it is indeed in the past.
if token.NotBefore != nil {
nbfTime := time.Time(*token.NotBefore)
leeway := 1 * time.Minute
// Set to 5 minutes since this is what other OpenID Connect providers do to deal with clock skew.
// https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/6.12.2/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs#L149-L153
leeway := 5 * time.Minute

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

0 comments on commit bd31461

Please sign in to comment.