aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/markbates
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-04-30 04:05:59 +0300
committerBo-Yi Wu <appleboy.tw@gmail.com>2018-04-30 09:05:59 +0800
commitff64f188fdb2c1abf74d51df145e60d5e9463fb1 (patch)
tree6e44409e30fb1da979685e21be626bd91e81f8f0 /vendor/github.com/markbates
parent6f62d4f180e09e7a762c2de11f1bc3c624f626ea (diff)
downloadgitea-ff64f188fdb2c1abf74d51df145e60d5e9463fb1.tar.gz
gitea-ff64f188fdb2c1abf74d51df145e60d5e9463fb1.zip
Switch back to upstream goth repository and update govendor to latest goth version (#3863)
Diffstat (limited to 'vendor/github.com/markbates')
-rw-r--r--vendor/github.com/markbates/goth/README.md1
-rw-r--r--vendor/github.com/markbates/goth/gothic/gothic.go12
2 files changed, 6 insertions, 7 deletions
diff --git a/vendor/github.com/markbates/goth/README.md b/vendor/github.com/markbates/goth/README.md
index 05b19fce5a..737d9ecff4 100644
--- a/vendor/github.com/markbates/goth/README.md
+++ b/vendor/github.com/markbates/goth/README.md
@@ -46,6 +46,7 @@ $ go get github.com/markbates/goth
* Linkedin
* Meetup
* MicrosoftOnline
+* Naver
* OneDrive
* OpenID Connect (auto discovery)
* Paypal
diff --git a/vendor/github.com/markbates/goth/gothic/gothic.go b/vendor/github.com/markbates/goth/gothic/gothic.go
index 7d6ac2ab6a..19dacb44b0 100644
--- a/vendor/github.com/markbates/goth/gothic/gothic.go
+++ b/vendor/github.com/markbates/goth/gothic/gothic.go
@@ -10,16 +10,16 @@ package gothic
import (
"bytes"
"compress/gzip"
+ "crypto/rand"
"encoding/base64"
"errors"
"fmt"
+ "io"
"io/ioutil"
- "math/rand"
"net/http"
"net/url"
"os"
"strings"
- "time"
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
@@ -35,8 +35,6 @@ var defaultStore sessions.Store
var keySet = false
-var gothicRand *rand.Rand
-
func init() {
key := []byte(os.Getenv("SESSION_SECRET"))
keySet = len(key) != 0
@@ -45,7 +43,6 @@ func init() {
cookieStore.Options.HttpOnly = true
Store = cookieStore
defaultStore = Store
- gothicRand = rand.New(rand.NewSource(time.Now().UnixNano()))
}
/*
@@ -85,8 +82,9 @@ var SetState = func(req *http.Request) string {
//
// https://auth0.com/docs/protocols/oauth2/oauth-state#keep-reading
nonceBytes := make([]byte, 64)
- for i := 0; i < 64; i++ {
- nonceBytes[i] = byte(gothicRand.Int63() % 256)
+ _, err := io.ReadFull(rand.Reader, nonceBytes)
+ if err != nil {
+ panic("gothic: source of randomness unavailable: " + err.Error())
}
return base64.URLEncoding.EncodeToString(nonceBytes)
}