oidc

package
v0.23.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	// Identity is the user's identity, extracted from the email claim (or sub if email not present).
	Identity string

	// ExpiresAt is when the token expires.
	ExpiresAt time.Time
}

Claims represents the claims extracted from an OIDC token.

type Config

type Config struct {
	// Issuer is the OIDC provider issuer URL (e.g., "https://accounts.google.com").
	Issuer string

	// ClientID is the expected audience claim. Required: without it, any
	// token issued by the provider for any client would be accepted.
	ClientID string

	// TLSConfig configures TLS for OIDC provider connections.
	TLSConfig tlsconfig.Config
}

Config configures the OIDC validator.

type Validator

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

Validator validates OIDC JWT tokens.

func NewValidator

func NewValidator(ctx context.Context, config Config) (*Validator, error)

NewValidator creates a new OIDC token validator. It performs OIDC discovery to fetch the provider's JWKS (public keys).

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, tokenString string) (*Claims, error)

Validate validates an OIDC JWT token and extracts claims. Returns Claims if the token is valid, error otherwise.

Jump to

Keyboard shortcuts

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