Documentation
¶
Index ¶
- func ExtractExpiryFromAccessToken(token string) (int, error)
- func ExtractUsernameFromAccessToken(token string) (string, error)
- func IsEncrypted(buffer []byte) (bool, error)
- func SshAuthentication(url, sshKeyPath, sshPassphrase string) (sshAuthHeaders map[string]string, newUrl string, err error)
- type CommonConfigFields
- func (ds *CommonConfigFields) AuthenticateSsh(sshKeyPath, sshPassphrase string) error
- func (ds *CommonConfigFields) CreateHttpClientDetails() httputils.HttpClientDetails
- func (ds *CommonConfigFields) GetAccessToken() string
- func (ds *CommonConfigFields) GetApiKey() string
- func (ds *CommonConfigFields) GetClientCertKeyPath() string
- func (ds *CommonConfigFields) GetClientCertPath() string
- func (ds *CommonConfigFields) GetPassword() string
- func (ds *CommonConfigFields) GetSshAuthHeaders() map[string]string
- func (ds *CommonConfigFields) GetSshKeyPath() string
- func (ds *CommonConfigFields) GetSshPassphrase() string
- func (ds *CommonConfigFields) GetSshUrl() string
- func (ds *CommonConfigFields) GetTokenRefreshHandler() TokenRefreshHandlerFunc
- func (ds *CommonConfigFields) GetUrl() string
- func (ds *CommonConfigFields) GetUser() string
- func (ds *CommonConfigFields) HandleTokenExpiry(statusCode int, httpClientDetails *httputils.HttpClientDetails) (bool, error)
- func (ds *CommonConfigFields) IsSshAuthHeaderSet() bool
- func (ds *CommonConfigFields) IsSshAuthentication() bool
- func (ds *CommonConfigFields) SetAccessToken(accessToken string)
- func (ds *CommonConfigFields) SetApiKey(apiKey string)
- func (ds *CommonConfigFields) SetClientCertKeyPath(certificatePath string)
- func (ds *CommonConfigFields) SetClientCertPath(certificatePath string)
- func (ds *CommonConfigFields) SetPassword(password string)
- func (ds *CommonConfigFields) SetSshAuthHeaders(sshAuthHeaders map[string]string)
- func (ds *CommonConfigFields) SetSshKeyPath(sshKeyPath string)
- func (ds *CommonConfigFields) SetSshPassphrase(sshPassphrase string)
- func (ds *CommonConfigFields) SetSshUrl(sshUrl string)
- func (ds *CommonConfigFields) SetTokenRefreshHandler(tokenRefreshHandler TokenRefreshHandlerFunc)
- func (ds *CommonConfigFields) SetUrl(url string)
- func (ds *CommonConfigFields) SetUser(user string)
- type CommonDetails
- type SshAuthResult
- type TokenPayload
- type TokenRefreshHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractExpiryFromAccessToken ¶
Extracts the expiry from an access token, in seconds
func IsEncrypted ¶
Types ¶
type CommonConfigFields ¶
type CommonConfigFields struct {
Url string `json:"-"`
User string `json:"-"`
Password string `json:"-"`
ApiKey string `json:"-"`
AccessToken string `json:"-"`
TokenRefreshHandler TokenRefreshHandlerFunc `json:"-"`
ClientCertPath string `json:"-"`
ClientCertKeyPath string `json:"-"`
Version string `json:"-"`
SshUrl string `json:"-"`
SshKeyPath string `json:"-"`
SshPassphrase string `json:"-"`
SshAuthHeaders map[string]string `json:"-"`
TokenMutex sync.Mutex
}
func (*CommonConfigFields) AuthenticateSsh ¶
func (ds *CommonConfigFields) AuthenticateSsh(sshKeyPath, sshPassphrase string) error
func (*CommonConfigFields) CreateHttpClientDetails ¶
func (ds *CommonConfigFields) CreateHttpClientDetails() httputils.HttpClientDetails
func (*CommonConfigFields) GetAccessToken ¶
func (ds *CommonConfigFields) GetAccessToken() string
func (*CommonConfigFields) GetApiKey ¶
func (ds *CommonConfigFields) GetApiKey() string
func (*CommonConfigFields) GetClientCertKeyPath ¶
func (ds *CommonConfigFields) GetClientCertKeyPath() string
func (*CommonConfigFields) GetClientCertPath ¶
func (ds *CommonConfigFields) GetClientCertPath() string
func (*CommonConfigFields) GetPassword ¶
func (ds *CommonConfigFields) GetPassword() string
func (*CommonConfigFields) GetSshAuthHeaders ¶
func (ds *CommonConfigFields) GetSshAuthHeaders() map[string]string
func (*CommonConfigFields) GetSshKeyPath ¶
func (ds *CommonConfigFields) GetSshKeyPath() string
func (*CommonConfigFields) GetSshPassphrase ¶
func (ds *CommonConfigFields) GetSshPassphrase() string
func (*CommonConfigFields) GetSshUrl ¶
func (ds *CommonConfigFields) GetSshUrl() string
func (*CommonConfigFields) GetTokenRefreshHandler ¶
func (ds *CommonConfigFields) GetTokenRefreshHandler() TokenRefreshHandlerFunc
func (*CommonConfigFields) GetUrl ¶
func (ds *CommonConfigFields) GetUrl() string
func (*CommonConfigFields) GetUser ¶
func (ds *CommonConfigFields) GetUser() string
func (*CommonConfigFields) HandleTokenExpiry ¶
func (ds *CommonConfigFields) HandleTokenExpiry(statusCode int, httpClientDetails *httputils.HttpClientDetails) (bool, error)
Checks if a token has expired. If so, acquires a new token from server (if one wasn't acquired yet) and returns true. Otherwise, or in case of an error, returns false.
func (*CommonConfigFields) IsSshAuthHeaderSet ¶
func (ds *CommonConfigFields) IsSshAuthHeaderSet() bool
func (*CommonConfigFields) IsSshAuthentication ¶
func (ds *CommonConfigFields) IsSshAuthentication() bool
func (*CommonConfigFields) SetAccessToken ¶
func (ds *CommonConfigFields) SetAccessToken(accessToken string)
func (*CommonConfigFields) SetApiKey ¶
func (ds *CommonConfigFields) SetApiKey(apiKey string)
func (*CommonConfigFields) SetClientCertKeyPath ¶
func (ds *CommonConfigFields) SetClientCertKeyPath(certificatePath string)
func (*CommonConfigFields) SetClientCertPath ¶
func (ds *CommonConfigFields) SetClientCertPath(certificatePath string)
func (*CommonConfigFields) SetPassword ¶
func (ds *CommonConfigFields) SetPassword(password string)
func (*CommonConfigFields) SetSshAuthHeaders ¶
func (ds *CommonConfigFields) SetSshAuthHeaders(sshAuthHeaders map[string]string)
func (*CommonConfigFields) SetSshKeyPath ¶
func (ds *CommonConfigFields) SetSshKeyPath(sshKeyPath string)
func (*CommonConfigFields) SetSshPassphrase ¶
func (ds *CommonConfigFields) SetSshPassphrase(sshPassphrase string)
func (*CommonConfigFields) SetSshUrl ¶
func (ds *CommonConfigFields) SetSshUrl(sshUrl string)
func (*CommonConfigFields) SetTokenRefreshHandler ¶
func (ds *CommonConfigFields) SetTokenRefreshHandler(tokenRefreshHandler TokenRefreshHandlerFunc)
func (*CommonConfigFields) SetUrl ¶
func (ds *CommonConfigFields) SetUrl(url string)
func (*CommonConfigFields) SetUser ¶
func (ds *CommonConfigFields) SetUser(user string)
type CommonDetails ¶
type CommonDetails interface {
GetUrl() string
GetUser() string
GetPassword() string
GetApiKey() string
GetAccessToken() string
GetTokenRefreshHandler() TokenRefreshHandlerFunc
GetClientCertPath() string
GetClientCertKeyPath() string
GetSshUrl() string
GetSshKeyPath() string
GetSshPassphrase() string
GetSshAuthHeaders() map[string]string
GetVersion() (string, error)
SetUrl(url string)
SetUser(user string)
SetPassword(password string)
SetApiKey(apiKey string)
SetAccessToken(accessToken string)
SetTokenRefreshHandler(TokenRefreshHandlerFunc)
SetClientCertPath(certificatePath string)
SetClientCertKeyPath(certificatePath string)
SetSshUrl(url string)
SetSshKeyPath(sshKeyPath string)
SetSshPassphrase(sshPassphrase string)
SetSshAuthHeaders(sshAuthHeaders map[string]string)
IsSshAuthHeaderSet() bool
IsSshAuthentication() bool
AuthenticateSsh(sshKey, sshPassphrase string) error
HandleTokenExpiry(statusCode int, httpClientDetails *httputils.HttpClientDetails) (bool, error)
CreateHttpClientDetails() httputils.HttpClientDetails
}
type SshAuthResult ¶
type TokenPayload ¶
type TokenRefreshHandlerFunc ¶
Implement this function and pass it to the CommonDetails struct to handle access token refresh if needed
Click to show internal directories.
Click to hide internal directories.