mirror of https://github.com/golang-jwt/jwt.git
Merge branch 'master' of github.com:cenkalti/jwt-go
This commit is contained in:
commit
45070d60b9
8
jwt.go
8
jwt.go
|
@ -86,7 +86,10 @@ func (t *Token) SigningString() (string, error) {
|
||||||
// If everything is kosher, err will be nil
|
// If everything is kosher, err will be nil
|
||||||
func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
|
func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
|
||||||
parts := strings.Split(tokenString, ".")
|
parts := strings.Split(tokenString, ".")
|
||||||
if len(parts) == 3 {
|
if len(parts) != 3 {
|
||||||
|
return nil, &ValidationError{err: "Token contains an invalid number of segments", Errors: ValidationErrorMalformed}
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
token := &Token{Raw: tokenString}
|
token := &Token{Raw: tokenString}
|
||||||
// parse Header
|
// parse Header
|
||||||
|
@ -150,9 +153,6 @@ func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return token, vErr
|
return token, vErr
|
||||||
|
|
||||||
}
|
|
||||||
return nil, &ValidationError{err: "Token contains an invalid number of segments", Errors: ValidationErrorMalformed}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The errors that might occur when parsing and validating a token
|
// The errors that might occur when parsing and validating a token
|
||||||
|
|
Loading…
Reference in New Issue