authtest

package
v1.0.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 9 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 authtest signs tokens the way Dex does, for tests.

Index

Constants

View Source
const (
	IssuerURL = "https://dex.example.io"
	Audience  = "beekeeper"
)

The issuer and audience tests use.

Variables

This section is empty.

Functions

func PersonClaims

func PersonClaims(email string, groups []string, exp time.Time) map[string]any

PersonClaims are the claims of a person's token for Beekeeper.

func PersonSubject

func PersonSubject(email string) string

PersonSubject is a sub Dex could give a person signed in through a connector.

func PrincipalClaims

func PrincipalClaims(clientID string, exp time.Time) map[string]any

PrincipalClaims are the claims of a principal client's own client_credentials token for Beekeeper, as Dex issues it.

Types

type Issuer

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

Issuer signs tokens with its own key.

func NewIssuer

func NewIssuer() *Issuer

NewIssuer returns an issuer at IssuerURL with a new key.

func (*Issuer) Discovery

func (i *Issuer) Discovery(jwksURL string) []byte

Discovery is the issuer's discovery document, with its keys at jwksURL.

func (*Issuer) JWKS

func (i *Issuer) JWKS() []byte

JWKS is the issuer's key set, as its jwks_uri serves it.

func (*Issuer) Person

func (i *Issuer) Person(email string, groups []string, exp time.Time) string

Person signs a person's token.

func (*Issuer) Principal

func (i *Issuer) Principal(clientID string, exp time.Time) string

Principal signs a principal's token.

func (*Issuer) Sign

func (i *Issuer) Sign(claims map[string]any) string

Sign signs claims, adding iss and iat when they are missing.

func (*Issuer) Verifier

func (i *Issuer) Verifier(audience string, now func() time.Time) *auth.OIDCVerifier

Verifier verifies the issuer's tokens for an audience with a static key set, against the clock now.

Jump to

Keyboard shortcuts

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