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

oauthclient

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CallbackLocal     = "local"
	CallbackAgentDock = "agentdock"
	CallbackNexus     = "nexus"

	StatusUnauthorized = "unauthorized"
	StatusAuthRequired = "auth_required"
	StatusAuthorizing  = "authorizing"
	StatusAuthorized   = "authorized"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequiredError

type AuthRequiredError struct {
	Server string
}

func (*AuthRequiredError) Error

func (e *AuthRequiredError) Error() string

type BeginResult

type BeginResult struct {
	AuthorizationURL string           `json:"authorization_url,omitempty"`
	CallbackID       string           `json:"callback_id,omitempty"`
	ExpiresAt        string           `json:"expires_at,omitempty"`
	CallbackOptions  []CallbackOption `json:"callback_options,omitempty"`
}

type CallbackOption

type CallbackOption struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	RedirectURL string `json:"-"`
}

type CallbackResult

type CallbackResult struct {
	State            string `json:"state"`
	Code             string `json:"code,omitempty"`
	Issuer           string `json:"iss,omitempty"`
	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
}

type ClientRecord

type ClientRecord struct {
	Issuer                  string    `json:"issuer"`
	RedirectURL             string    `json:"redirect_url"`
	ClientID                string    `json:"client_id"`
	ClientSecret            string    `json:"client_secret,omitempty"`
	TokenEndpointAuthMethod string    `json:"token_endpoint_auth_method,omitempty"`
	ClientIDIssuedAt        time.Time `json:"client_id_issued_at,omitempty"`
	ClientSecretExpiresAt   time.Time `json:"client_secret_expires_at,omitempty"`
	LastUsedAt              time.Time `json:"last_used_at,omitempty"`
}

type FlowError

type FlowError struct {
	Code    string
	Message string
	Cause   error
}

func (*FlowError) Error

func (e *FlowError) Error() string

func (*FlowError) Unwrap

func (e *FlowError) Unwrap() error

type Grant

type Grant struct {
	SchemaVersion   int       `json:"schema_version"`
	Endpoint        string    `json:"endpoint"`
	Resource        string    `json:"resource"`
	Issuer          string    `json:"issuer"`
	RedirectURL     string    `json:"redirect_url"`
	RegistrationKey string    `json:"registration_key"`
	TokenURL        string    `json:"token_url"`
	AccessToken     string    `json:"access_token"`
	RefreshToken    string    `json:"refresh_token,omitempty"`
	TokenType       string    `json:"token_type,omitempty"`
	Expiry          time.Time `json:"expiry,omitempty"`
	GrantedScopes   []string  `json:"granted_scopes,omitempty"`
	UpdatedAt       time.Time `json:"updated_at"`
}

type Handler

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

func (*Handler) Authorize

func (h *Handler) Authorize(_ context.Context, _ *http.Request, response *http.Response) error

func (*Handler) TokenSource

func (h *Handler) TokenSource(context.Context) (oauth2.TokenSource, error)

type Manager

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

func New

func New(agentDockHome string) (*Manager, error)

func (*Manager) Begin

func (m *Manager) Begin(ctx context.Context, server, storageKey, endpoint, callbackID string) (BeginResult, <-chan error, error)

func (*Manager) CallbackOptions

func (m *Manager) CallbackOptions() []CallbackOption

func (*Manager) Clear

func (m *Manager) Clear(storageKey string) error

func (*Manager) DeliverCallback

func (m *Manager) DeliverCallback(result CallbackResult) error

func (*Manager) Handler

func (m *Manager) Handler(server, storageKey, endpoint string) *Handler

func (*Manager) RecordChallenge

func (m *Manager) RecordChallenge(storageKey, endpoint string, headers []string)

func (*Manager) RemoveCallback

func (m *Manager) RemoveCallback(id string)

func (*Manager) RemoveGrant

func (m *Manager) RemoveGrant(storageKey string) error

func (*Manager) SetCallback

func (m *Manager) SetCallback(option CallbackOption) error

func (*Manager) Status

func (m *Manager) Status(storageKey, endpoint string) string

Jump to

Keyboard shortcuts

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