mirror of https://github.com/golang-jwt/jwt.git
capture raw string when parsing a token
This commit is contained in:
parent
51b517e77a
commit
32c540957a
3
jwt.go
3
jwt.go
|
@ -17,6 +17,7 @@ type Keyfunc func(*Token) ([]byte, error)
|
|||
|
||||
// A JWT Token
|
||||
type Token struct {
|
||||
Raw string
|
||||
Header map[string]interface{}
|
||||
Claims map[string]interface{}
|
||||
Method SigningMethod
|
||||
|
@ -81,7 +82,7 @@ func (t *Token) SigningString() (string, error) {
|
|||
func Parse(tokenString string, keyFunc Keyfunc) (token *Token, err error) {
|
||||
parts := strings.Split(tokenString, ".")
|
||||
if len(parts) == 3 {
|
||||
token = new(Token)
|
||||
token = &Token{Raw: tokenString}
|
||||
// parse Header
|
||||
var headerBytes []byte
|
||||
if headerBytes, err = DecodeSegment(parts[0]); err != nil {
|
||||
|
|
Loading…
Reference in New Issue