auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SiteBaseURL

func SiteBaseURL(domain string) string

SiteBaseURL normalizes a Confluence site base URL from a domain-like input.

Types

type Credentials

type Credentials struct {
	Domain   string `yaml:"domain"`
	Email    string `yaml:"email"`
	APIToken string `yaml:"api_token"`
}

Credentials contains the Confluence authentication values used by the CLI.

func RequireCredentials

func RequireCredentials(creds Credentials) (Credentials, error)

RequireCredentials validates that all required credential fields are present.

func ResolveRuntimeCredentials

func ResolveRuntimeCredentials(store Store) (Credentials, error)

ResolveRuntimeCredentials loads credentials from env vars and config storage.

func ResolveValidationCredentials

func ResolveValidationCredentials(configCreds Credentials) (Credentials, error)

ResolveValidationCredentials merges config credentials with env overrides for validation.

type HTTPValidator

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

HTTPValidator validates credentials using Confluence HTTP endpoints.

func NewHTTPValidator

func NewHTTPValidator(client *http.Client) *HTTPValidator

NewHTTPValidator builds an HTTP-based credential validator.

func (*HTTPValidator) Validate

func (v *HTTPValidator) Validate(ctx context.Context, creds Credentials) error

Validate checks whether the provided credentials can access Confluence.

type Prompter

type Prompter interface {
	Prompt(label string) (string, error)
	PromptSecret(label string) (string, error)
}

Prompter reads credential values from an interactive input source.

type Store

type Store interface {
	Path() (string, error)
	Load() (Credentials, error)
	Save(Credentials) error
	Clear() error
}

Store persists Confluence credentials between CLI runs.

type TerminalPrompter

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

TerminalPrompter implements Prompter using stdin/stdout.

func NewTerminalPrompter

func NewTerminalPrompter(stdin *os.File, stdout io.Writer) *TerminalPrompter

NewTerminalPrompter returns a terminal-backed credential prompter.

func (*TerminalPrompter) Prompt

func (p *TerminalPrompter) Prompt(label string) (string, error)

Prompt writes a label and reads a line of input.

func (*TerminalPrompter) PromptSecret

func (p *TerminalPrompter) PromptSecret(label string) (string, error)

PromptSecret writes a label and reads a password without echoing it.

type Validator

type Validator interface {
	Validate(context.Context, Credentials) error
}

Validator validates Confluence credentials against the remote API.

type XDGConfigStore

type XDGConfigStore struct{}

XDGConfigStore stores credentials in the user's XDG config directory.

func NewXDGConfigStore

func NewXDGConfigStore() *XDGConfigStore

NewXDGConfigStore creates a store backed by the XDG config path.

func (*XDGConfigStore) Clear

func (s *XDGConfigStore) Clear() error

Clear removes persisted credential fields from the config file.

func (*XDGConfigStore) Load

func (s *XDGConfigStore) Load() (Credentials, error)

Load reads credentials from the config file if it exists.

func (*XDGConfigStore) Path

func (s *XDGConfigStore) Path() (string, error)

Path returns the config file path used for persisted credentials.

func (*XDGConfigStore) Save

func (s *XDGConfigStore) Save(creds Credentials) error

Save writes validated credentials to the config file.

Jump to

Keyboard shortcuts

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