jwtutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package jwtutil provides mechanisms for interacting with JWTs.

Index

Constants

View Source
const IAMKeyEndpoint = "https://www.googleapis.com/oauth2/v3/certs"

Variables

This section is empty.

Functions

This section is empty.

Types

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier allows for getting public JWK keys from an endpoint and validating JWTs with those keys.

func NewVerifier

func NewVerifier(ctx context.Context, endpoint string) (*Verifier, error)

NewVerifier returns a Verifier with the cache initialized. The cache is set up using defaults, and refreshes happen every 15 minutes.

func (*Verifier) ValidateJWT

func (j *Verifier) ValidateJWT(jwtStr string) (jwt.Token, error)

ValidateJWT takes a jwt string, converts it to a jwt.Token, and validates the signature against the public keys in the JWKS endpoint.

Jump to

Keyboard shortcuts

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