Help us shape the future of Go! Take the 2026 Go Developer Survey

oidc

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Overview

Package oidc provides an OpenID Connect identity provider for the API Portal's IDP mode.

It serves HTTPS, because the portal only provisions organizations from claims that reached it over verified TLS, and it keeps no state. The caller of the authorization endpoint names the signed-in identity in the LoginHeader request header, standing in for the provider's own login session. The issued authorization code carries that identity, signed by the service, so the token endpoint needs no record of it and one shared instance serves every block.

Index

Constants

View Source
const (
	EnvTLSCert = "TESTBENCH_OIDC_TLS_CERT"
	EnvTLSKey  = "TESTBENCH_OIDC_TLS_KEY"
)

EnvTLSCert and EnvTLSKey name the variables holding the PEM certificate and key the service serves HTTPS with. When both are unset the service generates a self-signed certificate.

View Source
const EnvIssuer = "TESTBENCH_OIDC_ISSUER"

EnvIssuer names the variable holding the issuer URL the service signs tokens with. When it is unset the issuer is derived from the request's host.

View Source
const LoginHeader = "X-Testbench-Login"

LoginHeader carries the signed-in identity on an authorization request: the base64url encoding of a JSON object whose members become the issued tokens' claims.

View Source
const OrgClaim = "org_id"

OrgClaim is the claim an authorization request's organization hint is matched against.

View Source
const Port = 3015

Port is the container port used by the testbench.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service implements testbench.Service and testbench.TLSService.

func FromEnvironment

func FromEnvironment() (*Service, error)

FromEnvironment builds the service from EnvTLSCert, EnvTLSKey and EnvIssuer.

func New

func New(certPEM, keyPEM []byte, issuer string) (*Service, error)

New returns an identity provider serving HTTPS with the supplied PEM certificate and key, or with a generated self-signed certificate when both are empty. issuer is the issuer URL tokens are signed with; empty derives it from each request's host.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler serves the authorization, token, key-set and token-minting endpoints.

func (*Service) Name

func (s *Service) Name() string

Name returns the service registration name.

func (*Service) Port

func (s *Service) Port() int

Port returns the service port.

func (*Service) Stateful

func (s *Service) Stateful() bool

Stateful reports that the service keeps no state between requests.

func (*Service) TLSConfig

func (s *Service) TLSConfig() *tls.Config

TLSConfig returns the HTTPS configuration the service is served with.

Jump to

Keyboard shortcuts

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