From 32c540957a85111ee4084a73f3a36a80ab684383 Mon Sep 17 00:00:00 2001 From: Dave Grijalva Date: Tue, 2 Oct 2012 19:13:21 -0700 Subject: [PATCH] capture raw string when parsing a token --- jwt.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jwt.go b/jwt.go index bc84b4b..166bbbf 100644 --- a/jwt.go +++ b/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 {