authtest

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package authtest is an identity provider for tests: a discovery document and a key set served over a real listener, so the code under test runs its actual discovery and key fetch rather than being handed a key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServiceAccount

func ServiceAccount(namespace, name string) string

ServiceAccount is the subject a cluster gives a service account's token.

Types

type Issuer

type Issuer struct {
	URL string
	// contains filtered or unexported fields
}

Issuer is one identity provider. A cluster's service-account issuer is one of these too, as far as the code under test can tell.

func NewIssuer

func NewIssuer(t *testing.T) *Issuer

NewIssuer starts an issuer that stops when the test ends.

func (*Issuer) Token

func (is *Issuer) Token(t *testing.T, from, subject string, mutate func(*jwt.Builder)) string

Token mints a token for subject with audience "audit", signed by this issuer and naming from as its issuer — which is this one unless a test is forging. mutate says what else is true of it.

Jump to

Keyboard shortcuts

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