mirror of
https://github.com/portainer/portainer.git
synced 2025-08-09 15:55:23 +02:00
fix(jwt): replace deprecated gorilla/securecookie [EE-5153] (#9262)
This commit is contained in:
parent
9fac997300
commit
fc89066846
7 changed files with 22 additions and 20 deletions
16
api/internal/securecookie/securecookie.go
Normal file
16
api/internal/securecookie/securecookie.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package securecookie
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"io"
|
||||
)
|
||||
|
||||
// GenerateRandomKey generates a random key of specified length
|
||||
// source: https://github.com/gorilla/securecookie/blob/master/securecookie.go#L515
|
||||
func GenerateRandomKey(length int) []byte {
|
||||
k := make([]byte, length)
|
||||
if _, err := io.ReadFull(rand.Reader, k); err != nil {
|
||||
return nil
|
||||
}
|
||||
return k
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue