Update thermokarst/jwt
This commit is contained in:
parent
031538cc18
commit
5bae0238de
2 changed files with 3 additions and 9 deletions
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
|
@ -51,7 +51,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/thermokarst/jwt",
|
"ImportPath": "github.com/thermokarst/jwt",
|
||||||
"Rev": "6b69668616b8d8598fddf36b4bb4e4e3acb56008"
|
"Rev": "ce0235af93669b32c6ba1b7cde9f3632b76a6c91"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "golang.org/x/crypto/bcrypt",
|
"ImportPath": "golang.org/x/crypto/bcrypt",
|
||||||
|
|
10
Godeps/_workspace/src/github.com/thermokarst/jwt/jwt.go
generated
vendored
10
Godeps/_workspace/src/github.com/thermokarst/jwt/jwt.go
generated
vendored
|
@ -11,7 +11,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -103,15 +102,10 @@ func (m *Middleware) Secure(h http.Handler, v VerifyClaimsFunc) http.Handler {
|
||||||
|
|
||||||
authHeader := r.Header.Get("Authorization")
|
authHeader := r.Header.Get("Authorization")
|
||||||
if authHeader == "" {
|
if authHeader == "" {
|
||||||
queryParam := r.FormValue("token")
|
token = r.FormValue("token")
|
||||||
if queryParam == "" {
|
if token == "" {
|
||||||
return &jwtError{status: http.StatusUnauthorized, err: ErrMissingToken}
|
return &jwtError{status: http.StatusUnauthorized, err: ErrMissingToken}
|
||||||
}
|
}
|
||||||
var err error
|
|
||||||
token, err = url.QueryUnescape(queryParam)
|
|
||||||
if err != nil {
|
|
||||||
return &jwtError{status: http.StatusUnauthorized, err: ErrMalformedToken}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
token = strings.Split(authHeader, " ")[1]
|
token = strings.Split(authHeader, " ")[1]
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue