Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongSignature = errors.New("token uses the wrong signature algorithm") ErrPublicKeyNotFound = errors.New("token references unknown public key") ErrInvalidToken = errors.New("token is invalid") ErrIssuedAt = errors.New("token used before issued") ErrExpired = errors.New("token is expired") ErrInvalidIssuer = errors.New("token has an invalid issuer") ErrInvalidAudience = errors.New("token has an invalid audience") ErrInvalidDomain = errors.New("token has an invalid domain") )
View Source
var ( // TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). // You can override it to use another time value. This is useful for testing or if your // server uses a different time zone than your tokens. TimeFunc = time.Now )
Functions ¶
This section is empty.
Types ¶
type GoogleClaims ¶
type StandardClaims ¶
type StandardClaims struct { Issuer string `json:"iss"` AuthorizedParty string `json:"azp"` Audience string `json:"aud"` Subject string `json:"sub"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` AtHash string `json:"at_hash"` Name string `json:"name"` Picture string `json:"picture"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Locale string `json:"locale"` HD string `json:"hd"` IssuedAt int64 `json:"iat"` ExpiresAt int64 `json:"exp"` // contains filtered or unexported fields }
func (*StandardClaims) SetAllowedSkew ¶
func (c *StandardClaims) SetAllowedSkew(skew time.Duration)
func (StandardClaims) Valid ¶
func (c StandardClaims) Valid() error
Validates time based claims "exp, iat, nbf". There is no accounting for clock skew. As well, if any of the above claims are not in the token, it will still be considered a valid claim.
func (*StandardClaims) VerifyAudience ¶
func (c *StandardClaims) VerifyAudience(audience string) bool
Compares the Audience claim against audience. If required is false, this method will return true if the value matches or is unset
func (*StandardClaims) VerifyDomain ¶
func (c *StandardClaims) VerifyDomain(domain string) bool
Compares the Domain claim against domain. If required is false, this method will return true if the value matches or is unset
type Verifier ¶
func NewVerifier ¶
func NewVerifier() *Verifier
func (*Verifier) VerifyIDToken ¶
func (v *Verifier) VerifyIDToken(token string, claims GoogleClaims) error
func (*Verifier) WithAudiences ¶
func (*Verifier) WithDomains ¶
Click to show internal directories.
Click to hide internal directories.