mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-05 22:21:18 +02:00
Support nonce checks in OIDC Provider (#967)
* Set and verify a nonce with OIDC * Create a CSRF object to manage nonces & cookies * Add missing generic cookie unit tests * Add config flag to control OIDC SkipNonce * Send hashed nonces in authentication requests * Encrypt the CSRF cookie * Add clarity to naming & add more helper methods * Make CSRF an interface and keep underlying nonces private * Add ReverseProxy scope to cookie tests * Align to new 1.16 SameSite cookie default * Perform SecretBytes conversion on CSRF cookie crypto * Make state encoding signatures consistent * Mock time in CSRF struct via Clock * Improve InsecureSkipNonce docstring
This commit is contained in:
@@ -264,6 +264,7 @@ func parseProviderInfo(o *options.Options, msgs []string) []string {
|
||||
p.SetTeam(o.Providers[0].BitbucketConfig.Team)
|
||||
p.SetRepository(o.Providers[0].BitbucketConfig.Repository)
|
||||
case *providers.OIDCProvider:
|
||||
p.SkipNonce = o.Providers[0].OIDCConfig.InsecureSkipNonce
|
||||
if p.Verifier == nil {
|
||||
msgs = append(msgs, "oidc provider requires an oidc issuer URL")
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package validation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -50,10 +51,11 @@ func validateRedisSessionStore(o *options.Options) []string {
|
||||
return []string{fmt.Sprintf("unable to initialize a redis client: %v", err)}
|
||||
}
|
||||
|
||||
nonce, err := encryption.Nonce()
|
||||
n, err := encryption.Nonce()
|
||||
if err != nil {
|
||||
return []string{fmt.Sprintf("unable to generate a redis initialization test key: %v", err)}
|
||||
}
|
||||
nonce := base64.RawURLEncoding.EncodeToString(n)
|
||||
|
||||
key := fmt.Sprintf("%s-healthcheck-%s", o.Cookie.Name, nonce)
|
||||
return sendRedisConnectionTest(client, key, nonce)
|
||||
|
||||
Reference in New Issue
Block a user