Involved Source Filescache.gocompute.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.govalidate.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.
certResponse represents a list jwks. It is the format returned from known
Google cert endpoints.
Keys[]jwk
func findMatchingKey(response *certResponse, keyID string) (*jwk, error)
jwt represents the segments of a jwt and exposes convenience methods for
working with the different segments.
headerstringpayloadstringsignaturestring(*T) String() string
decodedHeader base64 decodes the header segment.
decodedPayload base64 payload the header segment.
decodedPayload base64 payload the header segment.
hashedContent gets the SHA256 checksum for verification of the JWT.
parsedHeader returns a struct representing a JWT header.
parsedPayload returns a struct representing a JWT payload.
*T : expvar.Var
*T : fmt.Stringer
*T : context.stringer
*T : runtime.stringer
func parseJWT(idToken string) (*jwt, 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.
computeTokenSource checks if this code is being run on GCE. If it is, it will
use the metadata service to build a TokenSource that fetches ID tokens.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.