oidc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package oidc is the relying party, and the only package in this repository that knows what JOSE is (ADR-0036).

Everything the library is good at happens here - discovery, the key set and its rotation, the signature check - and nothing of it escapes: the application layer holds `core/port/identityprovider` and its four plain structs, so replacing go-oidc tomorrow is an edit to one directory. `gate-architecture` proves that confinement rather than trusting it.

Index

Constants

View Source
const TargetClass = "identity_provider"

TargetClass labels the outbound calls this package makes, for the duration histogram. A class rather than a host, because the host is a tenant's choice (§3.2, rule 10).

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the relying party for every workspace on this installation.

One object, many workspaces: the configuration travels per call, and what is cached is keyed by issuer. Two workspaces pointed at the same provider share its discovery, which is right - the metadata belongs to the provider, not to whoever configured it.

func New

func New(client *http.Client, clk clock.Clock) *Provider

New builds the relying party. The client must be the guarded one: an issuer is a URL a tenant administrator typed, so it is an egress channel exactly as a webhook target is (rule 6, T-07).

func (*Provider) AuthorizationURL

func (p *Provider) AuthorizationURL(
	ctx context.Context, cfg port.Config, auth port.Authorization,
) (string, error)

AuthorizationURL performs discovery and builds the authorization request.

func (*Provider) Check

func (p *Provider) Check(ctx context.Context, issuer string) error

Check confirms the issuer is one: reachable, and naming itself the same in its own metadata.

It shares the discovery cache with the flow, which is what makes configuring a provider warm the path the first sign-in takes.

func (*Provider) Exchange

func (p *Provider) Exchange(
	ctx context.Context, cfg port.Config, exchange port.Exchange,
) (port.Identity, error)

Exchange trades the code and verifies what comes back.

Every failure below the transport answers one code. That is deliberate: which of the checks refused a token is a detail that helps whoever forged it and nobody else, and the trail carries the distinction for the people who are allowed to see it.

Jump to

Keyboard shortcuts

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