auth

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package auth implements the LazyCat account token contract used by lzc-cli 2.0.9 without interactive prompts.

Index

Constants

View Source
const (
	DefaultAccountURL = "https://account.lazycat.cloud"
	DefaultTokenEnv   = "LZC_CLI_TOKEN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain []TokenProvider

func (Chain) Token

func (chain Chain) Token(ctx context.Context) (string, error)

type Client

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

func NewClient

func NewClient(options ClientOptions) *Client

func (*Client) Login

func (client *Client) Login(ctx context.Context, credentials Credentials) (Session, error)

func (*Client) Validate

func (client *Client) Validate(ctx context.Context, token string) error

type ClientOptions

type ClientOptions struct {
	BaseURL    string
	HTTPClient *http.Client
	Store      TokenStore
}

type Credentials

type Credentials struct {
	Username string
	Password string
}

type EnvironmentToken

type EnvironmentToken struct {
	Name   string
	Lookup func(string) (string, bool)
}

func (EnvironmentToken) Token

func (provider EnvironmentToken) Token(ctx context.Context) (string, error)

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore(token string) *MemoryStore

func (*MemoryStore) Delete

func (store *MemoryStore) Delete(ctx context.Context) error

func (*MemoryStore) Load

func (store *MemoryStore) Load(ctx context.Context) (string, error)

func (*MemoryStore) Save

func (store *MemoryStore) Save(ctx context.Context, token string) error

type Session

type Session struct {
	Token string
}

type StaticToken

type StaticToken string

func (StaticToken) Token

func (provider StaticToken) Token(ctx context.Context) (string, error)

type StoreProvider

type StoreProvider struct{ Store TokenStore }

func (StoreProvider) Token

func (provider StoreProvider) Token(ctx context.Context) (string, error)

type TokenProvider

type TokenProvider interface {
	Token(context.Context) (string, error)
}

type TokenStore

type TokenStore interface {
	Load(context.Context) (string, error)
	Save(context.Context, string) error
	Delete(context.Context) error
}

Directories

Path Synopsis
Package tokenfile provides optional atomic token persistence.
Package tokenfile provides optional atomic token persistence.

Jump to

Keyboard shortcuts

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