Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleIdTokenPayload ¶
type GoogleIdTokenPayload struct { Issuer string `json:"iss"` Audience string `json:"aud"` Expires int64 `json:"exp"` IssuedAt int64 `json:"iat"` Subject string `json:"sub,omitempty"` Claims map[string]interface{} `json:"-"` }
func ParsePayload ¶
func ParsePayload(idToken string) (*GoogleIdTokenPayload, error)
ParsePayload parses the given token and returns its payload.
Warning: This function does not validate the token prior to parsing it.
ParsePayload is primarily meant to be used to inspect a token's payload. This is useful when validation fails and the payload needs to be inspected.
Note: A successful Validate() invocation with the same token will return an identical payload.
func (*GoogleIdTokenPayload) GetClaims ¶
func (p *GoogleIdTokenPayload) GetClaims() *GoogleUserClaims
type GoogleUserClaims ¶
type Validator ¶
type Validator struct { }
Validator provides a way to validate Google ID Tokens
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) ValidateToken ¶
func (v *Validator) ValidateToken(idToken string, audience string) (*GoogleIdTokenPayload, error)
Validate is used to validate the provided idToken with a known Google cert URL. If audience is not empty the audience claim of the Token is validated. Upon successful validation a parsed token Payload is returned allowing the caller to valdate any additional claims.i