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

oidctest

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package oidctest is a small in-process OIDC provider for mnemon tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDP

type IDP struct {
	URL      string
	Issuer   string
	Key      *rsa.PrivateKey
	Kid      string
	Audience string

	// NextAccessTTL overrides the access-token lifetime for the next token response.
	NextAccessTTL time.Duration
	// contains filtered or unexported fields
}

IDP serves discovery, JWKS, an authorization redirect, and a token endpoint.

func New

func New(t *testing.T) *IDP

New starts a loopback IdP. The issuer is the server URL.

func (*IDP) Fetches

func (p *IDP) Fetches() int

Fetches is how many times JWKS was downloaded.

func (*IDP) HideKey

func (p *IDP) HideKey(kid string)

HideKey removes a kid from the published JWKS until it is rotated back in.

func (*IDP) RotateKey

func (p *IDP) RotateKey(t *testing.T, kid string)

RotateKey adds a new signing key and uses it for later tokens.

func (*IDP) SetGroups

func (p *IDP) SetGroups(principal string, groups []string)

SetGroups sets the groups claim for a principal issued by this IdP.

func (*IDP) ShowKey

func (p *IDP) ShowKey(kid string, pub *rsa.PublicKey)

ShowKey publishes a previously hidden kid.

func (*IDP) Sign

func (p *IDP) Sign(principal string, ttl time.Duration, extra jwt.MapClaims) string

Sign builds an access token. extra claims override defaults.

Jump to

Keyboard shortcuts

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