Merge pull request #133 from johnlockwood-wf/expire-delta

Include expire delta in error message
This commit is contained in:
Dave Grijalva 2016-05-04 10:20:39 -07:00
commit 3cf07b8a28
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"strings"
"time"
)
type Parser struct {
@ -113,7 +114,8 @@ func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
}
if vexp && now > exp {
vErr.Inner = fmt.Errorf("token is expired")
delta := time.Unix(now, 0).Sub(time.Unix(exp, 0))
vErr.Inner = fmt.Errorf("token is expired by %v", delta)
vErr.Errors |= ValidationErrorExpired
}