auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context) (*types.Token, error)
	Refresh(ctx context.Context) (*types.Token, error)
	IsTokenValid() bool
	GetToken() *types.Token
}

Authenticator defines the interface for authentication strategies.

type OAuthRefreshAuthenticator

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

OAuthRefreshAuthenticator implements OAuth 2.0 refresh token flow.

func NewOAuthRefreshAuthenticator

func NewOAuthRefreshAuthenticator(clientID, clientSecret, refreshToken, tokenURL string, httpClient *http.Client) *OAuthRefreshAuthenticator

NewOAuthRefreshAuthenticator creates a new OAuth refresh token authenticator.

func (*OAuthRefreshAuthenticator) Authenticate

func (a *OAuthRefreshAuthenticator) Authenticate(ctx context.Context) (*types.Token, error)

Authenticate performs authentication using the refresh token.

func (*OAuthRefreshAuthenticator) GetToken

func (a *OAuthRefreshAuthenticator) GetToken() *types.Token

GetToken returns the current token.

func (*OAuthRefreshAuthenticator) IsTokenValid

func (a *OAuthRefreshAuthenticator) IsTokenValid() bool

IsTokenValid checks if the current token is valid.

func (*OAuthRefreshAuthenticator) Refresh

Refresh refreshes the access token using the refresh token.

type PasswordAuthenticator

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

PasswordAuthenticator implements username/password authentication.

func NewPasswordAuthenticator

func NewPasswordAuthenticator(username, password, securityToken, clientID, clientSecret, loginURL string, httpClient *http.Client) *PasswordAuthenticator

NewPasswordAuthenticator creates a new password authenticator.

func (*PasswordAuthenticator) Authenticate

func (a *PasswordAuthenticator) Authenticate(ctx context.Context) (*types.Token, error)

Authenticate performs authentication using username and password.

func (*PasswordAuthenticator) GetToken

func (a *PasswordAuthenticator) GetToken() *types.Token

GetToken returns the current token.

func (*PasswordAuthenticator) IsTokenValid

func (a *PasswordAuthenticator) IsTokenValid() bool

IsTokenValid checks if the current token is valid.

func (*PasswordAuthenticator) Refresh

func (a *PasswordAuthenticator) Refresh(ctx context.Context) (*types.Token, error)

Refresh re-authenticates using credentials.

type TokenAuthenticator

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

TokenAuthenticator uses a pre-existing access token.

func NewTokenAuthenticator

func NewTokenAuthenticator(accessToken, instanceURL string) *TokenAuthenticator

NewTokenAuthenticator creates an authenticator with a pre-existing token.

func (*TokenAuthenticator) Authenticate

func (a *TokenAuthenticator) Authenticate(ctx context.Context) (*types.Token, error)

Authenticate returns the existing token.

func (*TokenAuthenticator) GetToken

func (a *TokenAuthenticator) GetToken() *types.Token

GetToken returns the current token.

func (*TokenAuthenticator) IsTokenValid

func (a *TokenAuthenticator) IsTokenValid() bool

IsTokenValid checks if the token is valid.

func (*TokenAuthenticator) Refresh

func (a *TokenAuthenticator) Refresh(ctx context.Context) (*types.Token, error)

Refresh cannot refresh a static token.

func (*TokenAuthenticator) SetToken

func (a *TokenAuthenticator) SetToken(token *types.Token)

SetToken updates the token.

Jump to

Keyboard shortcuts

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