mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
fix(jwt): replace deprecated gorilla/securecookie [EE-5153] (#9247)
This commit is contained in:
parent
4a90b8a3f7
commit
ca617e2ac9
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