oauthlogin

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package oauthlogin provides an opt-in, host-side OAuth loopback login runtime.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAuthorizationFailed reports a redacted failure of the authorization interaction.
	ErrAuthorizationFailed = errors.New("OAuth authorization failed")
	// ErrCallbackAttempts reports exhaustion of the callback request budget.
	ErrCallbackAttempts = errors.New("OAuth callback request limit exceeded")
)
View Source
var ErrBrowserLaunch = errors.New("could not open browser")

ErrBrowserLaunch indicates that the fixed host browser launcher could not start.

Functions

This section is empty.

Types

type AuthorizeFunc

type AuthorizeFunc func(ctx context.Context, redirectURL string, present func(context.Context, string) (Result, error)) error

AuthorizeFunc performs the controller-owned OAuth operation. It may call present once.

type BrowserLauncher

type BrowserLauncher interface {
	Open(context.Context, string) error
}

BrowserLauncher opens an authorization URL according to host policy.

type Options

type Options struct {
	NoBrowser bool
	URLWriter io.Writer
	Launcher  BrowserLauncher
}

Options configures a Runtime.

type Result

type Result struct {
	Code  string
	State string
	Iss   string
}

Result is the validated loopback authorization response.

type Runtime

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

Runtime serializes complete loopback authorization interactions.

func New

func New(opts Options) (*Runtime, error)

New constructs an opt-in loopback runtime.

func (*Runtime) Authorize

func (r *Runtime) Authorize(ctx context.Context, expectedIssuer string, authorize AuthorizeFunc) error

Authorize runs one loopback authorization interaction. Calls on the same Runtime are serialized.

Jump to

Keyboard shortcuts

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