mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-18 13:18:26 +02:00
chore: Updated go-jwt to v5
This commit is contained in:
@@ -114,9 +114,8 @@ func (j *jwtSessionLoader) getBasicToken(token string) (string, error) {
|
||||
|
||||
// check user, user+password, or just password for a token
|
||||
if j.jwtRegex.MatchString(user) {
|
||||
// Support blank passwords or magic `x-oauth-basic` passwords - nothing else
|
||||
/* #nosec G101 */
|
||||
if password == "" || password == "x-oauth-basic" {
|
||||
if password == "x-oauth-basic" || // #nosec G101 -- Support blank passwords or magic `x-oauth-basic` passwords, nothing else
|
||||
password == "" {
|
||||
return user, nil
|
||||
}
|
||||
} else if j.jwtRegex.MatchString(password) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/go-oidc/v3/oidc"
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
|
||||
sessionsapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -401,7 +401,7 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
|
||||
type idTokenClaims struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Verified *bool `json:"email_verified,omitempty"`
|
||||
jwt.StandardClaims
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
type tokenToSessionTableInput struct {
|
||||
@@ -451,13 +451,12 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
|
||||
},
|
||||
Entry("with no email", tokenToSessionTableInput{
|
||||
idToken: idTokenClaims{
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
Audience: "asdf1234",
|
||||
ExpiresAt: expiresFuture.Unix(),
|
||||
Id: "id-some-id",
|
||||
IssuedAt: time.Now().Unix(),
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Audience: jwt.ClaimStrings{"asdf1234"},
|
||||
ExpiresAt: jwt.NewNumericDate(expiresFuture),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
Issuer: "https://issuer.example.com",
|
||||
NotBefore: 0,
|
||||
NotBefore: jwt.NewNumericDate(time.Time{}),
|
||||
Subject: "123456789",
|
||||
},
|
||||
},
|
||||
@@ -468,13 +467,12 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
|
||||
}),
|
||||
Entry("with a verified email", tokenToSessionTableInput{
|
||||
idToken: idTokenClaims{
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
Audience: "asdf1234",
|
||||
ExpiresAt: expiresFuture.Unix(),
|
||||
Id: "id-some-id",
|
||||
IssuedAt: time.Now().Unix(),
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Audience: jwt.ClaimStrings{"asdf1234"},
|
||||
ExpiresAt: jwt.NewNumericDate(expiresFuture),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
Issuer: "https://issuer.example.com",
|
||||
NotBefore: 0,
|
||||
NotBefore: jwt.NewNumericDate(time.Time{}),
|
||||
Subject: "123456789",
|
||||
},
|
||||
Email: "foo@example.com",
|
||||
@@ -487,13 +485,12 @@ Nnc3a3lGVWFCNUMxQnNJcnJMTWxka1dFaHluYmI4Ongtb2F1dGgtYmFzaWM=`
|
||||
}),
|
||||
Entry("with a non-verified email", tokenToSessionTableInput{
|
||||
idToken: idTokenClaims{
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
Audience: "asdf1234",
|
||||
ExpiresAt: expiresFuture.Unix(),
|
||||
Id: "id-some-id",
|
||||
IssuedAt: time.Now().Unix(),
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Audience: jwt.ClaimStrings{"asdf1234"},
|
||||
ExpiresAt: jwt.NewNumericDate(expiresFuture),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
Issuer: "https://issuer.example.com",
|
||||
NotBefore: 0,
|
||||
NotBefore: jwt.NewNumericDate(time.Time{}),
|
||||
Subject: "123456789",
|
||||
},
|
||||
Email: "foo@example.com",
|
||||
|
||||
Reference in New Issue
Block a user