gcpcredential

package
v0.0.0-...-b55c306 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package gcpcredential contains functions to validate Google-issued ID tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, client *http.Client, credentials []string, expectedAudience string) ([]string, error)

Validate validates each of the provided credentials, then returns the emails of the successfully verified tokens/emails. If an http.Client is provided, it will be used to initialize the idtoken validation client.

func ValidateWithJWKS

func ValidateWithJWKS(jwks *JWKS, credentials []string, expectedAudience string) ([]string, error)

ValidateWithJWKS validates the provided credentials using the provided public keys. It is the caller's responsibility to retrieve and provide Google's JWKs (https://www.googleapis.com/oauth2/v3/certs).

Types

type JWK

type JWK struct {
	Alg string `json:"alg"`
	Crv string `json:"crv"`
	Kid string `json:"kid"`
	Kty string `json:"kty"`
	Use string `json:"use"`
	E   string `json:"e"`
	N   string `json:"n"`
	X   string `json:"x"`
	Y   string `json:"y"`
}

JWK is a subset of the JSON Web Key (JWK) format.

type JWKS

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS is a subset of the JSON Web Key Set (JWKSet) format.

Directories

Path Synopsis
Package main is a simple program to test the gcpcredential library against a GCP-issued token.
Package main is a simple program to test the gcpcredential library against a GCP-issued token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL