Documentation
¶
Index ¶
- type Authenticator
- type OAuthRefreshAuthenticator
- type PasswordAuthenticator
- type TokenAuthenticator
- func (a *TokenAuthenticator) Authenticate(ctx context.Context) (*types.Token, error)
- func (a *TokenAuthenticator) GetToken() *types.Token
- func (a *TokenAuthenticator) IsTokenValid() bool
- func (a *TokenAuthenticator) Refresh(ctx context.Context) (*types.Token, error)
- func (a *TokenAuthenticator) SetToken(token *types.Token)
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 ¶
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.
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 ¶
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.
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 ¶
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) SetToken ¶
func (a *TokenAuthenticator) SetToken(token *types.Token)
SetToken updates the token.