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 ¶
Authenticate performs username-password authentication.
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 ¶
Authenticate performs initial authentication.
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 ¶
Authenticate returns the existing token.