oidctokentest

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 7 Imported by: ? 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 oidctokentest provides a fake OpenID provider for tests of code that mints tokens with package oidctoken.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issuer

type Issuer struct {
	Server *httptest.Server
	// Response is encoded as the token endpoint's JSON body.
	Response map[string]any
	// contains filtered or unexported fields
}

Issuer is an in-process OpenID provider serving discovery and a token endpoint over TLS with a self-signed certificate, so sources pointed at it need InsecureSkipVerify. It records the last token request and counts the calls; Response is what the token endpoint returns and may be edited between requests.

func NewIssuer

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

NewIssuer starts an issuer advertising the client_credentials, password, and refresh_token grants and the given token endpoint authentication methods. It is closed when the test ends.

func (*Issuer) BasicAuth

func (i *Issuer) BasicAuth() (user, password string)

BasicAuth is the HTTP basic credential the last token request carried.

func (*Issuer) Form

func (i *Issuer) Form() url.Values

Form is the form the last token request carried.

func (*Issuer) SetResponse

func (i *Issuer) SetResponse(key string, value any)

SetResponse replaces one field of the token response.

func (*Issuer) TokenCalls

func (i *Issuer) TokenCalls() int

TokenCalls is how many times the token endpoint has been called.

func (*Issuer) URL

func (i *Issuer) URL() string

URL is the issuer URL to configure in a Source.

Jump to

Keyboard shortcuts

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