add ability to issue tokens with no expiry
This commit is contained in:
parent
1d17fe5577
commit
de907d83cb
5 changed files with 76 additions and 9 deletions
5
codec.go
5
codec.go
|
|
@ -41,7 +41,10 @@ func decodePayload(b []byte) (payload, error) {
|
|||
|
||||
// expired reports whether the payload's expiry has passed at the given time.
|
||||
// Uses >= so a token expiring exactly at `now` is considered expired
|
||||
// (the conservative choice).
|
||||
// (the conservative choice). Exp == 0 means the token never expires.
|
||||
func (p payload) expired(now time.Time) bool {
|
||||
if p.Exp == 0 {
|
||||
return false
|
||||
}
|
||||
return now.Unix() >= p.Exp
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue