capture raw string when parsing a token

This commit is contained in:
Dave Grijalva 2012-10-02 19:13:21 -07:00
parent 51b517e77a
commit 32c540957a
1 changed files with 2 additions and 1 deletions

3
jwt.go
View File

@ -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 {