Help us shape the future of Go! Take the 2026 Go Developer Survey

oidctest

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package oidctest provides a minimal in-process OIDC provider for tests. It serves a discovery document, JWKS, an auto-approving authorization endpoint, and a token endpoint, and can mint signed ID tokens directly.

Index

Constants

View Source
const ClientID = "epithet-test-client"

ClientID is the audience carried by every minted token.

View Source
const TokenEmail = "test@example.com"

TokenEmail is the profile email minted by the /token endpoint (browser-flow path).

Variables

This section is empty.

Functions

func Subject

func Subject(email string) string

Subject returns a deterministic test-only subject distinct from the email.

Types

type IdP

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

func New

func New(t *testing.T) *IdP

func (*IdP) Issuer

func (p *IdP) Issuer() string

func (*IdP) MintIDToken

func (p *IdP) MintIDToken(email string, expiresAt time.Time) string

func (*IdP) MintIDTokenWithAudience

func (p *IdP) MintIDTokenWithAudience(email, aud string, expiresAt time.Time) string

func (*IdP) MintIDTokenWithClaims

func (p *IdP) MintIDTokenWithClaims(email string, expiresAt time.Time, overrides map[string]any) string

MintIDTokenWithClaims overrides standard fixture claims. A nil value removes a claim, allowing malformed tokens to exercise the real validation boundary.

func (*IdP) SetDiscoveryAvailable

func (p *IdP) SetDiscoveryAvailable(available bool)

SetDiscoveryAvailable simulates a provider outage without changing its issuer or signing keys, including while clients are attempting discovery.

Jump to

Keyboard shortcuts

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