auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeaders

func GetHeaders() (http.Header, error)

func IsAuthenticated added in v1.4.0

func IsAuthenticated(authInfo *ResolvedAuth) bool

Types

type Auth

type Auth struct {
	APIKey       string     `json:"apiKey,omitempty"`
	BearerToken  string     `json:"bearerToken,omitempty"`
	RefreshToken string     `json:"refreshToken,omitempty"`
	OrgName      string     `json:"orgName"`
	ExpiresAt    *time.Time `json:"expiresAt,omitempty"`
}

type AuthSource

type AuthSource string
const (
	ConfigAuthSource    AuthSource = "config"
	KeyringAuthSource   AuthSource = "keyring"
	PlainTextAuthSource AuthSource = "plaintext"
)

type KeyringStorage added in v1.4.0

type KeyringStorage struct{}

KeyringStorage implements Storage using the system keyring

func NewKeyringStorage added in v1.4.0

func NewKeyringStorage() *KeyringStorage

func (*KeyringStorage) Delete added in v1.4.0

func (k *KeyringStorage) Delete() error

func (*KeyringStorage) Get added in v1.4.0

func (k *KeyringStorage) Get() (*Auth, error)

func (*KeyringStorage) Source added in v1.4.0

func (k *KeyringStorage) Source() AuthSource

func (*KeyringStorage) Store added in v1.4.0

func (k *KeyringStorage) Store(auth *Auth) error

type PlainTextStorage added in v1.4.0

type PlainTextStorage struct{}

PlainTextStorage implements Storage using a plain text file

func NewPlainTextStorage added in v1.4.0

func NewPlainTextStorage() *PlainTextStorage

func (*PlainTextStorage) Delete added in v1.4.0

func (p *PlainTextStorage) Delete() error

func (*PlainTextStorage) Get added in v1.4.0

func (p *PlainTextStorage) Get() (*Auth, error)

func (*PlainTextStorage) Source added in v1.4.0

func (p *PlainTextStorage) Source() AuthSource

func (*PlainTextStorage) Store added in v1.4.0

func (p *PlainTextStorage) Store(auth *Auth) error

type ResolvedAuth

type ResolvedAuth struct {
	Auth
	Source AuthSource `json:"source"`
}

func ResolveAuth

func ResolveAuth() (*ResolvedAuth, error)

type Storage added in v1.4.0

type Storage interface {
	Store(auth *Auth) error
	Get() (*Auth, error)
	Delete() error
	Source() AuthSource
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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