fix: jwt error overrwriten by nil public key (#20387)

This commit is contained in:
jiuker 2024-09-06 10:46:36 +08:00 committed by GitHub
parent 85f08d7752
commit 241be9709c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -148,7 +148,11 @@ func (r *Config) Validate(ctx context.Context, arn arn.ARN, token, accessToken,
if !ok {
return nil, fmt.Errorf("Invalid kid value %v", jwtToken.Header["kid"])
}
return r.pubKeys.get(kid), nil
pubkey := r.pubKeys.get(kid)
if pubkey == nil {
return nil, fmt.Errorf("No public key found for kid %s", kid)
}
return pubkey, nil
}
pCfg, ok := r.arnProviderCfgsMap[arn]