auth

package
v2.0.2 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

Overview

Package auth provides authentication strategies for Salesforce.

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 authentication interface.

type BaseAuthenticator

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

BaseAuthenticator provides common authentication functionality.

func (*BaseAuthenticator) GetToken

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

GetToken returns the current token.

func (*BaseAuthenticator) IsTokenValid

func (a *BaseAuthenticator) IsTokenValid() bool

IsTokenValid checks if the current token is valid.

func (*BaseAuthenticator) SetToken

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

SetToken sets the current token.

type PasswordAuthenticator

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

PasswordAuthenticator uses username-password flow.

func NewPasswordAuthenticator

func NewPasswordAuthenticator(clientID, clientSecret, username, password, securityToken, tokenURL string) *PasswordAuthenticator

NewPasswordAuthenticator creates a password authenticator.

func (*PasswordAuthenticator) Authenticate

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

Authenticate performs username-password authentication.

func (*PasswordAuthenticator) Refresh

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

Refresh re-authenticates using credentials.

type RefreshTokenAuthenticator

type RefreshTokenAuthenticator struct {
	BaseAuthenticator
	// contains filtered or unexported fields
}

RefreshTokenAuthenticator uses OAuth 2.0 refresh token flow.

func NewRefreshTokenAuthenticator

func NewRefreshTokenAuthenticator(clientID, clientSecret, refreshToken, tokenURL string) *RefreshTokenAuthenticator

NewRefreshTokenAuthenticator creates a refresh token authenticator.

func (*RefreshTokenAuthenticator) Authenticate

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

Authenticate performs initial authentication.

func (*RefreshTokenAuthenticator) Refresh

Refresh refreshes the access token.

type TokenAuthenticator

type TokenAuthenticator struct {
	BaseAuthenticator
}

TokenAuthenticator uses a pre-existing token.

func NewTokenAuthenticator

func NewTokenAuthenticator(accessToken, instanceURL string) *TokenAuthenticator

NewTokenAuthenticator creates a token authenticator.

func (*TokenAuthenticator) Authenticate

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

Authenticate returns the existing token.

func (*TokenAuthenticator) Refresh

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

Refresh is not supported for token authenticator.

Jump to

Keyboard shortcuts

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