mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
OIDC cookie: use a cryptographically secure random string
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
package httpd
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"sync"
|
||||
@@ -53,10 +51,8 @@ type oauth2PendingAuth struct {
|
||||
}
|
||||
|
||||
func newOAuth2PendingAuth(provider int, redirectURL, clientID string, clientSecret *kms.Secret) oauth2PendingAuth {
|
||||
state := sha256.Sum256(util.GenerateRandomBytes(32))
|
||||
|
||||
return oauth2PendingAuth{
|
||||
State: hex.EncodeToString(state[:]),
|
||||
State: util.GenerateOpaqueString(),
|
||||
Provider: provider,
|
||||
ClientID: clientID,
|
||||
ClientSecret: clientSecret,
|
||||
|
||||
Reference in New Issue
Block a user