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

oidc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Grant

type Grant struct {
	User          User
	Nonce         string
	CodeChallenge string
	RedirectURI   string

	// A nil value removes the claim.
	IDTokenClaims  map[string]any
	UserInfoClaims map[string]any

	OmitIDToken       bool
	IDTokenForeignKey bool
	UserInfoSubject   string
	UserInfoStatus    int
	UserInfoBody      string

	SignUserInfo       bool
	UserInfoForeignKey bool
	UserInfoAlgorithm  jose.SignatureAlgorithm
}

type Issuer

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

func New

func New(opts ...Option) *Issuer

func (*Issuer) ClientID

func (i *Issuer) ClientID() string

func (*Issuer) Code

func (i *Issuer) Code(grant Grant) string

func (*Issuer) FailExchange

func (i *Issuer) FailExchange(subject string)

FailExchange answers the code exchanges of the subject with status 503 and temporarily_unavailable.

func (*Issuer) FailKeySet

func (i *Issuer) FailKeySet(status int)

FailKeySet answers the JWKS with the status. Status 0 serves the keys again.

func (*Issuer) PadKeySet

func (i *Issuer) PadKeySet(size int)

PadKeySet adds a member of the size in bytes to the JWKS. Size 0 removes it.

func (*Issuer) RedirectURI

func (i *Issuer) RedirectURI(subject string) string

RedirectURI returns the redirect_uri of the last code exchange of the subject.

func (*Issuer) Requests

func (i *Issuer) Requests(path string) int

Requests returns the number of requests the issuer received on the path, such as "/jwks".

func (*Issuer) RotateKey

func (i *Issuer) RotateKey() error

RotateKey signs every later token with a new key, which the JWKS serves beside the previous ones.

func (*Issuer) Settings

func (i *Issuer) Settings() map[string]any

func (*Issuer) Start

func (i *Issuer) Start(_ context.Context, injector do.Injector) error

func (*Issuer) Stop

func (i *Issuer) Stop(context.Context) error

func (*Issuer) URL

func (i *Issuer) URL() string

type Option

type Option func(*options)

func WithListedAlgorithms

func WithListedAlgorithms(algorithms ...string) Option

WithListedAlgorithms replaces id_token_signing_alg_values_supported of the discovery document, which lists the signing algorithm by default.

func WithListedUserInfoAlgorithms

func WithListedUserInfoAlgorithms(algorithms ...string) Option

WithListedUserInfoAlgorithms sets userinfo_signing_alg_values_supported of the discovery document, which leaves it out by default.

func WithRedirectURIs

func WithRedirectURIs(uris ...string) Option

func WithSigningAlgorithm

func WithSigningAlgorithm(algorithm jose.SignatureAlgorithm) Option

WithSigningAlgorithm signs the tokens with the algorithm, RS256 by default. ES256 signs with an EC P-256 key, and RS* and PS* sign with an RSA key. New panics for any other algorithm.

type User

type User struct {
	Subject           string
	Email             string
	Name              string
	PreferredUsername string
}

Jump to

Keyboard shortcuts

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