Skip to content

Commit

Permalink
Merge branch 'dooglegh-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-hanna committed Feb 6, 2018
2 parents ac543da + 82e3786 commit b3aba6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jwt/jwtToken.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func (t *jwtToken) myLog(stoofs interface{}) {

func (c *credentials) buildTokenWithClaimsFromString(tokenString string, verifyKey interface{}, validTime time.Duration) *jwtToken {
// note @adam-hanna: should we be checking inputs? Especially the token string?

var newToken jwtToken

token, err := jwtGo.ParseWithClaims(tokenString, &ClaimsType{}, func(token *jwtGo.Token) (interface{}, error) {
Expand All @@ -39,6 +38,12 @@ func (c *credentials) buildTokenWithClaimsFromString(tokenString string, verifyK
return verifyKey, nil
})

if token == nil {
token = new(jwtGo.Token)
token.Claims = new(ClaimsType)
c.myLog("token is nil, set empty token (parse error=" + err.Error() + ")")
}

newToken.Token = token
newToken.ParseErr = err

Expand Down

0 comments on commit b3aba6b

Please sign in to comment.