From c9ab96ba53bcd70914eb1a6146d6205036e2519b Mon Sep 17 00:00:00 2001 From: Luis Gabriel Gomez Date: Sun, 22 Aug 2021 05:18:33 -0300 Subject: [PATCH] jwt: Fix Verify methods documentation (#83) --- claims.go | 12 ++++++------ map_claims.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/claims.go b/claims.go index 7c2f33b..019f007 100644 --- a/claims.go +++ b/claims.go @@ -63,14 +63,14 @@ func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool { return verifyAud([]string{c.Audience}, cmp, req) } -// VerifyExpiresAt compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp). +// If req is false, it will return true, if exp is unset. func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool { return verifyExp(c.ExpiresAt, cmp, req) } -// VerifyIssuedAt compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat). +// If req is false, it will return true, if iat is unset. func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool { return verifyIat(c.IssuedAt, cmp, req) } @@ -81,8 +81,8 @@ func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool { return verifyIss(c.Issuer, cmp, req) } -// VerifyNotBefore compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). +// If req is false, it will return true, if nbf is unset. func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool { return verifyNbf(c.NotBefore, cmp, req) } diff --git a/map_claims.go b/map_claims.go index 7e00e75..c058d41 100644 --- a/map_claims.go +++ b/map_claims.go @@ -31,8 +31,8 @@ func (m MapClaims) VerifyAudience(cmp string, req bool) bool { return verifyAud(aud, cmp, req) } -// VerifyExpiresAt compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp). +// If req is false, it will return true, if exp is unset. func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { exp, ok := m["exp"] if !ok { @@ -48,8 +48,8 @@ func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { return false } -// VerifyIssuedAt compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat). +// If req is false, it will return true, if iat is unset. func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { iat, ok := m["iat"] if !ok { @@ -72,8 +72,8 @@ func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { return verifyIss(iss, cmp, req) } -// VerifyNotBefore compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset +// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). +// If req is false, it will return true, if nbf is unset. func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { nbf, ok := m["nbf"] if !ok {