mirror of https://github.com/portainer/portainer
fix(jwt): replace deprecated gorilla/securecookie [EE-5153] (#9247)
parent
4a90b8a3f7
commit
ca617e2ac9
@ -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…
Reference in new issue