move to base64 urlencoding for xsrf
This commit is contained in:
parent
c28249e1ce
commit
2e70a95bcd
1 changed files with 2 additions and 2 deletions
|
|
@ -22,11 +22,11 @@ func genKey(length int) (bytes []byte) {
|
||||||
|
|
||||||
func newXsrf(secret []byte) string {
|
func newXsrf(secret []byte) string {
|
||||||
rnd := genKey(keySize)
|
rnd := genKey(keySize)
|
||||||
return base64.RawStdEncoding.EncodeToString(append(rnd, xor(rnd, secret)...))
|
return base64.RawURLEncoding.EncodeToString(append(rnd, xor(rnd, secret)...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkXsrf(xsrf string, secret []byte) bool {
|
func checkXsrf(xsrf string, secret []byte) bool {
|
||||||
t, err := base64.RawStdEncoding.DecodeString(xsrf)
|
t, err := base64.RawURLEncoding.DecodeString(xsrf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue