identitytest

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package identitytest holds the conformance suite of identity.Verifier and a signer of Access JWTs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newFixture func(t *testing.T) Fixture)

Run runs the suite.

Types

type Fixture

type Fixture struct {
	Verifier identity.Verifier
	// Subject is the subject of the principal that Valid gives.
	Subject string
	// Valid carries a credential that the Verifier accepts.
	Valid func() *http.Request
	// Expired carries a credential that has expired.
	Expired func() *http.Request
	// Forged carries a credential that is signed by a key that the Verifier does not trust.
	Forged func() *http.Request
	// Revoked carries a credential that was revoked. It is nil for a credential that cannot be revoked.
	Revoked func() *http.Request
}

Fixture is a Verifier and the requests that it must judge. Each request func returns a new request.

type Issuer

type Issuer struct {
	Kid string
	Key *rsa.PrivateKey
	// URL is the address of the key set.
	URL string
}

Issuer signs Access JWTs with a new RSA key and serves the key set of it.

func NewIssuer

func NewIssuer(t testing.TB, kid string) *Issuer

NewIssuer starts a key set server that t stops.

func (*Issuer) Sign

func (i *Issuer) Sign(t testing.TB, claims map[string]any) string

Sign returns an RS256 JWT with the claims, under the kid of the issuer.

Jump to

Keyboard shortcuts

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