authtest

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 3 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 implements the shared contract tests for enrollment authorizer implementations, the databases' impl/dbtest pattern: an implementation has at least one test that runs this suite. Recorder is the authorizer the seam's callers test with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, s Suite)

Run tests one implementation of the enrollauth.AdmissionAuthorizer contract: the verdict vocabulary, and the fail-closed rule — a gate that cannot reach its signal denies.

Types

type Recorder

type Recorder struct {
	// Asked holds the facts of every ask, in order.
	Asked []enrollauth.AdmissionFacts
	// Verdict is the answer every ask receives.
	Verdict enrollauth.AdmissionVerdict
}

Recorder is an authorizer that records the facts it is asked with and answers every ask with its verdict.

func (*Recorder) Authorize

Authorize records the facts and answers the verdict.

type Suite

type Suite struct {
	// New builds the authorizer under test.
	New func(t *testing.T) enrollauth.AdmissionAuthorizer
	// Facts builds the facts the implementation cannot decide — a request
	// carrying no address for the CIDR authorizer, a prompt the Telegram
	// one cannot send — the fail-closed rule's input.
	Facts func(t *testing.T) enrollauth.AdmissionFacts
}

Suite describes one implementation's run of the contract tests.

Jump to

Keyboard shortcuts

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