add new property IdentifierDefaultLogoTargetURI

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2025-04-28 13:36:13 +02:00
parent 515cd1f978
commit 16307e036d
41 changed files with 123 additions and 287 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ package identity
import (
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/lico/oidc/payload"
)
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"net/http"
"net/url"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/oidc-go"
)
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"sync"
"github.com/go-jose/go-jose/v3"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/oidc-go"
"github.com/sirupsen/logrus"
+1 -1
View File
@@ -20,7 +20,7 @@ package identity
import (
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/lico/oidc/payload"
)
+2 -7
View File
@@ -18,17 +18,12 @@
package clients
import (
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
)
// RegistrationClaims are claims used to with dynamic clients.
type RegistrationClaims struct {
jwt.StandardClaims
jwt.RegisteredClaims
*ClientRegistration
}
// Valid implements the jwt claims interface.
func (crc RegistrationClaims) Valid() error {
return crc.StandardClaims.Valid()
}
+9 -9
View File
@@ -25,7 +25,7 @@ import (
"fmt"
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/longsleep/rndm"
"github.com/mendsley/gojwk"
"golang.org/x/crypto/blake2b"
@@ -54,9 +54,9 @@ type ClientRegistration struct {
ImplicitScopes []string `yaml:"implicit_scopes" json:"-"`
Dynamic bool `yaml:"-" json:"-"`
IDIssuedAt int64 `yaml:"-" json:"-"`
SecretExpiresAt int64 `yaml:"-" json:"-"`
Dynamic bool `yaml:"-" json:"-"`
IDIssuedAt time.Time `yaml:"-" json:"-"`
SecretExpiresAt time.Time `yaml:"-" json:"-"`
Contacts []string `yaml:"contacts,flow" json:"contacts,omitempty"`
Name string `yaml:"name" json:"name,omitempty"`
@@ -153,9 +153,9 @@ func (cr *ClientRegistration) SetDynamic(ctx context.Context, creator func(ctx c
}
// Initialize basic client registration data for dynamic client.
cr.IDIssuedAt = time.Now().Unix()
cr.IDIssuedAt = time.Now()
if registry.dynamicClientSecretDuration > 0 {
cr.SecretExpiresAt = time.Now().Add(registry.dynamicClientSecretDuration).Unix()
cr.SecretExpiresAt = time.Now().Add(registry.dynamicClientSecretDuration)
}
cr.Dynamic = true
@@ -168,10 +168,10 @@ func (cr *ClientRegistration) SetDynamic(ctx context.Context, creator func(ctx c
// client_id. See https://openid.net/specs/openid-connect-registration-1_0.html#StatelessRegistration
// for more information. We use a JWT as client_id.
claims := &RegistrationClaims{
StandardClaims: jwt.StandardClaims{
RegisteredClaims: jwt.RegisteredClaims{
Subject: sub,
IssuedAt: cr.IDIssuedAt,
ExpiresAt: cr.SecretExpiresAt,
IssuedAt: jwt.NewNumericDate(cr.IDIssuedAt),
ExpiresAt: jwt.NewNumericDate(cr.SecretExpiresAt),
},
ClientRegistration: cr,
}
+2 -2
View File
@@ -27,7 +27,7 @@ import (
"sync"
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/oidc-go"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
@@ -358,7 +358,7 @@ func (r *Registry) getDynamicClient(clientID string) (*ClientRegistration, bool)
// TODO(longsleep): Add secure client secret.
registration = claims.ClientRegistration
registration.ID = clientID
registration.Secret = claims.StandardClaims.Subject
registration.Secret = claims.RegisteredClaims.Subject
registration.Dynamic = true
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ import (
"strings"
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/gorilla/mux"
"github.com/libregraph/oidc-go"
"github.com/longsleep/rndm"
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"net/http"
"strings"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/gorilla/mux"
"github.com/libregraph/oidc-go"
"github.com/longsleep/rndm"
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"fmt"
"net/http"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/gorilla/mux"
"github.com/libregraph/oidc-go"
"github.com/longsleep/rndm"
+6 -2
View File
@@ -415,10 +415,14 @@ func (im *IdentifierIdentityManager) EndSession(ctx context.Context, rw http.Res
origin := utils.OriginFromRequestHeaders(req.Header)
clientID := ""
if esr.IDTokenHint != nil {
// Extended request, verify IDTokenHint and its claims if available.
esrClaims = esr.IDTokenHint.Claims.(*konnectoidc.IDTokenClaims)
clientDetails, err = im.clients.Lookup(ctx, esrClaims.Audience, "", esr.PostLogoutRedirectURI, origin, true)
if len(esrClaims.Audience) == 1 {
clientID = esrClaims.Audience[0]
}
clientDetails, err = im.clients.Lookup(ctx, clientID, "", esr.PostLogoutRedirectURI, origin, true)
if err != nil {
// This error is not fatal since according to
// the spec in https://openid.net/specs/openid-connect-session-1_0.html#RPLogout the
@@ -471,7 +475,7 @@ func (im *IdentifierIdentityManager) EndSession(ctx context.Context, rw http.Res
query.Add("flow", identifier.FlowOIDC)
}
if esrClaims != nil {
query.Add("client_id", esrClaims.Audience)
query.Add("client_id", clientID)
}
u.RawQuery = query.Encode()
+1 -1
View File
@@ -18,7 +18,7 @@
package identity
import (
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
)
// User defines a most simple user with an id defined as subject.
+1 -1
View File
@@ -20,7 +20,7 @@ package identity
import (
"fmt"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/libregraph/oidc-go"
konnectoidc "github.com/libregraph/lico/oidc"