mirror of https://github.com/golang-jwt/jwt.git
jwt: Fix Verify methods documentation (#83)
This commit is contained in:
parent
eac9e9edf2
commit
c9ab96ba53
12
claims.go
12
claims.go
|
@ -63,14 +63,14 @@ func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool {
|
||||||
return verifyAud([]string{c.Audience}, cmp, req)
|
return verifyAud([]string{c.Audience}, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyExpiresAt compares the exp claim against cmp.
|
// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if exp is unset.
|
||||||
func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
|
func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
|
||||||
return verifyExp(c.ExpiresAt, cmp, req)
|
return verifyExp(c.ExpiresAt, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyIssuedAt compares the iat claim against cmp.
|
// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if iat is unset.
|
||||||
func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
|
func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
|
||||||
return verifyIat(c.IssuedAt, cmp, req)
|
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)
|
return verifyIss(c.Issuer, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyNotBefore compares the nbf claim against cmp.
|
// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if nbf is unset.
|
||||||
func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
|
func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
|
||||||
return verifyNbf(c.NotBefore, cmp, req)
|
return verifyNbf(c.NotBefore, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
|
||||||
return verifyAud(aud, cmp, req)
|
return verifyAud(aud, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyExpiresAt compares the exp claim against cmp.
|
// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if exp is unset.
|
||||||
func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
|
func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
|
||||||
exp, ok := m["exp"]
|
exp, ok := m["exp"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -48,8 +48,8 @@ func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyIssuedAt compares the iat claim against cmp.
|
// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if iat is unset.
|
||||||
func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
|
func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
|
||||||
iat, ok := m["iat"]
|
iat, ok := m["iat"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -72,8 +72,8 @@ func (m MapClaims) VerifyIssuer(cmp string, req bool) bool {
|
||||||
return verifyIss(iss, cmp, req)
|
return verifyIss(iss, cmp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyNotBefore compares the nbf claim against cmp.
|
// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
|
||||||
// If required is false, this method will return true if the value matches or is unset
|
// If req is false, it will return true, if nbf is unset.
|
||||||
func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
|
func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
|
||||||
nbf, ok := m["nbf"]
|
nbf, ok := m["nbf"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue