oidcauth

package
v0.1.0-rc.39 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package oidcauth implements OIDC authentication and CLI login flows. OIDC back-channel requests do not follow redirects.

Index

Constants

View Source
const (
	LoginFlowDeviceCode            = "device_code"
	LoginFlowAuthorizationCodePKCE = "authorization_code_pkce"
)

Variables

View Source
var (
	ErrUnauthenticated = errors.New("oidcauth: unauthenticated")
	ErrUnavailable     = errors.New("oidcauth: provider unavailable")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Issuer     string
	ClientID   string
	LoginFlow  string
	Scopes     []string
	HTTPClient *http.Client
	OpenURL    func(string) error
	Prompt     func(Prompt) error
}

type Identity

type Identity struct {
	Issuer          string
	Subject         string
	DisplayName     string
	NormalizedEmail string
	EmailVerified   bool
	Nonce           string
	ExpiresAt       time.Time
	AssertionDigest [32]byte
}

Identity contains the limited identity fields authenticated by an OIDC ID token.

type Prompt

type Prompt struct {
	URL  string
	Code string
}

Prompt contains the user action needed to continue authentication.

type Result

type Result struct {
	IDToken  string
	Identity Identity
}

func Login

func Login(ctx context.Context, config Config, output io.Writer) (Result, error)

type Verifier

type Verifier interface {
	Verify(context.Context, string) (Identity, error)
}

Verifier verifies ID tokens from one exact OIDC issuer for one client.

func NewVerifier

func NewVerifier(config VerifierConfig) (Verifier, error)

NewVerifier validates configuration without contacting the provider.

type VerifierConfig

type VerifierConfig struct {
	Issuer     string
	ClientID   string
	HTTPClient *http.Client
}

Jump to

Keyboard shortcuts

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