auth

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteToken

func DeleteToken() error

func SaveToken

func SaveToken(token *StoredToken) error

func TokenFilePath

func TokenFilePath() (string, error)

Types

type APITokenProvider added in v0.1.1

type APITokenProvider struct {
	Email    string
	APIToken string
}

func NewAPITokenProvider added in v0.1.1

func NewAPITokenProvider(email, apiToken string) *APITokenProvider

func (*APITokenProvider) ApplyAuth added in v0.1.1

func (p *APITokenProvider) ApplyAuth(req *http.Request) error

func (*APITokenProvider) AuthStyle added in v0.1.1

func (p *APITokenProvider) AuthStyle() AuthStyle

func (*APITokenProvider) Token added in v0.1.1

func (p *APITokenProvider) Token() (string, error)

type AppPasswordProvider

type AppPasswordProvider struct {
	Username    string
	AppPassword string
}

func NewAppPasswordProvider

func NewAppPasswordProvider(username, appPassword string) *AppPasswordProvider

func (*AppPasswordProvider) ApplyAuth

func (p *AppPasswordProvider) ApplyAuth(req *http.Request) error

func (*AppPasswordProvider) AuthStyle

func (p *AppPasswordProvider) AuthStyle() AuthStyle

func (*AppPasswordProvider) Token

func (p *AppPasswordProvider) Token() (string, error)

type AuthStyle

type AuthStyle int
const (
	AuthStyleBearer AuthStyle = iota
	AuthStyleBasic
)

type OAuthProvider

type OAuthProvider struct {
	ClientID     string
	ClientSecret string
	// contains filtered or unexported fields
}

func NewOAuthProvider

func NewOAuthProvider(clientID, clientSecret string) *OAuthProvider

func (*OAuthProvider) ApplyAuth

func (p *OAuthProvider) ApplyAuth(req *http.Request) error

func (*OAuthProvider) AuthStyle

func (p *OAuthProvider) AuthStyle() AuthStyle

func (*OAuthProvider) Login

func (p *OAuthProvider) Login() error

func (*OAuthProvider) Token

func (p *OAuthProvider) Token() (string, error)

type Provider

type Provider interface {
	AuthStyle() AuthStyle
	Token() (string, error)
	ApplyAuth(req *http.Request) error
}

type StoredToken

type StoredToken struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	ExpiresAt    time.Time `json:"expires_at"`
	Scopes       string    `json:"scopes,omitempty"`
}

func LoadToken

func LoadToken() (*StoredToken, error)

func (*StoredToken) IsExpired

func (t *StoredToken) IsExpired() bool

Jump to

Keyboard shortcuts

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