oauth

package
v0.0.62 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOIDCProviderAndClient

func CreateOIDCProviderAndClient(cfg *config.StaticConfig) (*oidc.Provider, *http.Client, error)

CreateOIDCProviderAndClient builds an OIDC provider and HTTP client from config. Returns (nil, nil, nil) when AuthorizationURL is empty (OAuth not configured).

Types

type Snapshot

type Snapshot struct {
	OIDCProvider                     *oidc.Provider
	HTTPClient                       *http.Client
	AuthorizationURL                 string
	CertificateAuthority             string
	OAuthScopes                      []string
	DisableDynamicClientRegistration bool
}

Snapshot is an immutable point-in-time capture of OAuth-related state. It is swapped atomically via State so all consumers see a consistent view.

func SnapshotFromConfig

func SnapshotFromConfig(cfg *config.StaticConfig, provider *oidc.Provider, httpClient *http.Client) *Snapshot

SnapshotFromConfig extracts OAuth-relevant fields from a StaticConfig and pairs them with the corresponding OIDC provider and HTTP client.

func (*Snapshot) HasProviderConfigChanged

func (s *Snapshot) HasProviderConfigChanged(other *Snapshot) bool

HasProviderConfigChanged reports whether the fields that require OIDC provider and HTTP client recreation have changed between two snapshots.

func (*Snapshot) HasWellKnownConfigChanged

func (s *Snapshot) HasWellKnownConfigChanged(other *Snapshot) bool

HasWellKnownConfigChanged reports whether any WellKnown-serving fields changed.

type State

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

State holds the current OAuth snapshot and allows atomic, lock-free reads.

func NewState

func NewState(snap *Snapshot) *State

NewState creates a new State initialized with the given snapshot.

func (*State) Load

func (s *State) Load() *Snapshot

Load returns the current snapshot. Safe for concurrent use.

func (*State) Store

func (s *State) Store(snap *Snapshot)

Store atomically replaces the current snapshot.

Jump to

Keyboard shortcuts

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