auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlexTVURL       = "https://plex.tv/api/v2"
	DefaultTimeout  = 30 * time.Second
	DefaultClientID = "plexcli"
	DefaultProduct  = "plexcli"
	DefaultVersion  = "1.0.0"
	DefaultPlatform = "Go"
	StatusOK        = 200
	StatusCreated   = 201
)

Variables

View Source
var (
	ErrNoCredentials      = fmt.Errorf("no authentication credentials provided")
	ErrInvalidToken       = fmt.Errorf("invalid or expired token")
	ErrInvalidCredentials = fmt.Errorf("invalid username or password")
	ErrAuthFailed         = fmt.Errorf("authentication failed")
)

Functions

func GetToken

func GetToken(ctx context.Context, cfg config.Config) (string, error)

func GetTokenAndStore

func GetTokenAndStore(ctx context.Context, cfg config.Config) (string, error)

Types

type AuthMethod

type AuthMethod interface {
	Authenticate(ctx context.Context) (string, error)
	Name() string
}

type AutoAuth

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

func NewAutoAuth

func NewAutoAuth(cfg config.Config) *AutoAuth

func NewAutoAuthWithClientID

func NewAutoAuthWithClientID(cfg config.Config, clientID string) *AutoAuth

func (*AutoAuth) Authenticate

func (a *AutoAuth) Authenticate(ctx context.Context) (string, error)

func (*AutoAuth) Name

func (a *AutoAuth) Name() string

type PasswordAuth

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

func NewPasswordAuth

func NewPasswordAuth(username, password string) *PasswordAuth

func NewPasswordAuthWithClientID

func NewPasswordAuthWithClientID(username, password, clientID string) *PasswordAuth

func (*PasswordAuth) Authenticate

func (p *PasswordAuth) Authenticate(ctx context.Context) (string, error)

func (*PasswordAuth) Name

func (p *PasswordAuth) Name() string

type TokenAuth

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

func NewTokenAuth

func NewTokenAuth(token string) *TokenAuth

func (*TokenAuth) Authenticate

func (t *TokenAuth) Authenticate(ctx context.Context) (string, error)

func (*TokenAuth) Name

func (t *TokenAuth) Name() string

Jump to

Keyboard shortcuts

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