package idtoken

Import Path
	google.golang.org/api/idtoken (on go.dev)

Dependency Relation
	imports 23 packages, and imported by 2 packages

Involved Source Files cache.go compute.go Package idtoken provides utilities for creating authenticated transports with ID Tokens for Google HTTP APIs. It also provides methods to validate Google issued ID tokens. idtoken.go validate.go
Package-Level Type Names (total 11, in which 3 are exported)
/* sort exporteds by: | */
ClientOption is for configuring a Google API client or transport.
Payload represents a decoded payload of an ID Token. Audience string Claims map[string]interface{} Expires int64 IssuedAt int64 Issuer string Subject string func Validate(ctx context.Context, idToken string, audience string) (*Payload, error) func (*Validator).Validate(ctx context.Context, idToken string, audience string) (*Payload, error)
Validator provides a way to validate Google ID Tokens with a user provided http.Client. 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 validate any additional claims. func NewValidator(ctx context.Context, opts ...ClientOption) (*Validator, error)
Package-Level Functions (total 16, in which 8 are exported)
NewClient creates a HTTP Client that automatically adds an ID token to each request via an Authorization header. The token will have have the audience provided and be configured with the supplied options. The parameter audience may not be empty.
NewTokenSource creates a TokenSource that returns ID tokens with the audience provided and configured with the supplied options. The parameter audience may not be empty.
NewValidator creates a Validator that uses the options provided to configure a the internal http.Client that will be used to make requests to fetch JWKs.
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 validate any additional claims.
WithCredentialsFile returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials file.
WithCredentialsJSON returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials.
WithCustomClaims optionally specifies custom private claims for an ID token.
WithHTTPClient returns a ClientOption that specifies the HTTP client to use as the basis of communications. This option may only be used with services that support HTTP as their communication transport. When used, the WithHTTPClient option takes precedent over all other supplied options.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (total 3, none are exported)