Compare commits

..

2 Commits

Author SHA1 Message Date
lukaszraczylo cbe773d96a Merge pull request #20 from lukaszraczylo/additional-improvements
Provide default session encryption key if not specified.
2025-01-18 11:00:07 +00:00
lukaszraczylo 40254888d7 Provide default session encryption key if not specified. 2025-01-18 10:54:30 +00:00
+13
View File
@@ -175,6 +175,19 @@ func (t *TraefikOidc) VerifyJWTSignatureAndClaims(jwt *JWT, token string) error
// New creates a new instance of the OIDC middleware
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
if config == nil {
config = CreateConfig()
}
// Generate default session encryption key if not provided
if config.SessionEncryptionKey == "" {
key, err := generateNonce()
if err != nil {
return nil, fmt.Errorf("failed to generate session encryption key: %w", err)
}
config.SessionEncryptionKey = key
}
// Setup HTTP client
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,