mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-20 00:39:48 +02:00
csrf protection; always set state
This commit is contained in:
committed by
Jehiah Czebotar
parent
6c690b699b
commit
55085d9697
@@ -0,0 +1,16 @@
|
||||
package cookie
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Nonce() (nonce string, err error) {
|
||||
b := make([]byte, 16)
|
||||
_, err = rand.Read(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
nonce = fmt.Sprintf("%x", b)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user