mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-17 04:37:48 +00:00
Merge pull request #23 from lukaszraczylo/additional-improvements
Add useful defaults allowing traefik hub to pass.
This commit is contained in:
@@ -2,6 +2,7 @@ package traefikoidc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/rand"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@@ -181,11 +182,11 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
|
|||||||
|
|
||||||
// Generate default session encryption key if not provided
|
// Generate default session encryption key if not provided
|
||||||
if config.SessionEncryptionKey == "" {
|
if config.SessionEncryptionKey == "" {
|
||||||
key, err := generateNonce()
|
key := make([]byte, 32)
|
||||||
if err != nil {
|
if _, err := rand.Read(key); err != nil {
|
||||||
return nil, fmt.Errorf("failed to generate session encryption key: %w", err)
|
return nil, fmt.Errorf("failed to generate session encryption key: %w", err)
|
||||||
}
|
}
|
||||||
config.SessionEncryptionKey = key
|
config.SessionEncryptionKey = fmt.Sprintf("%x", key) // Convert to hex string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup HTTP client
|
// Setup HTTP client
|
||||||
|
|||||||
Reference in New Issue
Block a user