Documentation ¶
Overview ¶
Package jwt provides utility functions for validating JSON Web Tokens (JWT) as defined by Cloud Identity-Aware Proxy (Cloud IAP). This package follows the instructions specified at https://cloud.google.com/iap/docs/signed-headers-howtospecifications
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // PublicKeysURL is the URL from which public keys will be fetched. PublicKeysURL = "https://www.gstatic.com/iap/verify/public_key" // HTTPClient is the default HTTP Client to use for fetching public keys. HTTPClient = &http.Client{Timeout: 10 * time.Second} )
Functions ¶
func DecodePublicKeys ¶
DecodePublicKeys decodes all public keys from the given Reader.
func FetchPublicKeys ¶
FetchPublicKeys downloads and decodes all public keys from Google.
Types ¶
type Audience ¶
type Audience string
Audience is a string wrapper to provide validation logic for GCP IAP audience URLs. From the IAP docs at https://cloud.google.com/iap/docs/signed-headers-howto: Audience must be a string with the following values: * App Engine: /projects/PROJECT_NUMBER/apps/PROJECT_ID * Compute Engine and Container Engine: /projects/PROJECT_NUMBER/global/backendServices/SERVICE_ID
func NewAudience ¶
NewAudience returns an Audience from a string.
func ParseAudience ¶
ParseAudience parses an Audience from a string.
type Claims ¶
type Claims struct { jwt.StandardClaims Domain string `json:"hd,omitempty"` Email string `json:"email,omitempty"` // contains filtered or unexported fields }
Claims represents parsed JWT Token Claims.
func RequestClaims ¶
RequestClaims checks the validity and returns the claims in the request. Claims may be returned even if an error occurs.