auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorHTML []byte

ErrorHTML is the browser page shown after a failed auth callback.

View Source
var SuccessHTML []byte

SuccessHTML is the browser page shown after a successful auth callback.

Functions

func BindFreePort

func BindFreePort() (int, error)

BindFreePort returns an available localhost TCP port.

func BuildAuthURL

func BuildAuthURL(apiBase, callback, state, name string) string

BuildAuthURL returns the Disbug agent auth URL for the local callback.

func GenerateState

func GenerateState(r io.Reader) (string, error)

GenerateState creates a URL-safe CSRF state value.

func Open

func Open(rawURL string) error

Open opens rawURL with the current browser opener.

func ParsePastebackURL

func ParsePastebackURL(raw string) (token, state string, err error)

ParsePastebackURL extracts token and state from a manually pasted redirect URL.

Types

type BrowserOpener

type BrowserOpener = seams.BrowserOpener

BrowserOpener opens a URL in the user's browser.

func DefaultOpener

func DefaultOpener() BrowserOpener

DefaultOpener returns the platform browser opener.

func SwapBrowserOpener

func SwapBrowserOpener(next BrowserOpener) BrowserOpener

SwapBrowserOpener replaces the process-wide browser opener and returns the previous opener.

type CallbackResult

type CallbackResult struct {
	Token string
	State string
	Err   error
}

CallbackResult is the token callback result returned by Listener.Wait.

type Listener

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

Listener serves the local auth callback endpoint for browser login.

func NewListener

func NewListener(
	state string,
	success,
	errorPage []byte,
	addr string,
	factory seams.ListenerFactory,
	sleeper seams.Sleeper,
) (*Listener, error)

NewListener starts a local auth callback listener.

func (*Listener) Close

func (l *Listener) Close() error

Close shuts down the local auth callback listener.

func (*Listener) Port

func (l *Listener) Port() int

Port returns the TCP port the listener is bound to.

func (*Listener) Wait

func (l *Listener) Wait(ctx context.Context, timeout time.Duration) (CallbackResult, error)

Wait waits for an auth callback result, close, context cancellation, or timeout.

Jump to

Keyboard shortcuts

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