Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractExpiryFromAccessToken(token string) (int, error)
- func ExtractUsernameFromAccessToken(token string) (string, error)
- func GetTokenMinutesLeft(token string) (int64, error)
- func IsEncrypted(buffer []byte) (bool, error)
- func SshAuthentication(url, sshKeyPath, sshPassphrase string) (sshAuthHeaders map[string]string, newUrl string, err error)
- func SshTokenRefreshPreRequestInterceptor(fields *CommonConfigFields, httpClientDetails *httputils.HttpClientDetails) error
- type CommonConfigFields
- func (ccf *CommonConfigFields) AppendPreRequestInterceptor(interceptor PreRequestInterceptorFunc)
- func (ccf *CommonConfigFields) AuthenticateSsh(sshKeyPath, sshPassphrase string) error
- func (ccf *CommonConfigFields) CreateHttpClientDetails() httputils.HttpClientDetails
- func (ccf *CommonConfigFields) GetAccessToken() string
- func (ccf *CommonConfigFields) GetApiKey() string
- func (ccf *CommonConfigFields) GetClientCertKeyPath() string
- func (ccf *CommonConfigFields) GetClientCertPath() string
- func (ccf *CommonConfigFields) GetPassword() string
- func (ccf *CommonConfigFields) GetPreRequestInterceptor() []PreRequestInterceptorFunc
- func (ccf *CommonConfigFields) GetSshAuthHeaders() map[string]string
- func (ccf *CommonConfigFields) GetSshKeyPath() string
- func (ccf *CommonConfigFields) GetSshPassphrase() string
- func (ccf *CommonConfigFields) GetSshUrl() string
- func (ccf *CommonConfigFields) GetUrl() string
- func (ccf *CommonConfigFields) GetUser() string
- func (ccf *CommonConfigFields) InitSsh() error
- func (ccf *CommonConfigFields) IsSshAuthHeaderSet() bool
- func (ccf *CommonConfigFields) IsSshAuthentication() bool
- func (ccf *CommonConfigFields) RunPreRequestInterceptors(httpClientDetails *httputils.HttpClientDetails) error
- func (ccf *CommonConfigFields) SetAccessToken(accessToken string)
- func (ccf *CommonConfigFields) SetApiKey(apiKey string)
- func (ccf *CommonConfigFields) SetClientCertKeyPath(certificatePath string)
- func (ccf *CommonConfigFields) SetClientCertPath(certificatePath string)
- func (ccf *CommonConfigFields) SetPassword(password string)
- func (ccf *CommonConfigFields) SetSshAuthHeaders(sshAuthHeaders map[string]string)
- func (ccf *CommonConfigFields) SetSshKeyPath(sshKeyPath string)
- func (ccf *CommonConfigFields) SetSshPassphrase(sshPassphrase string)
- func (ccf *CommonConfigFields) SetSshUrl(sshUrl string)
- func (ccf *CommonConfigFields) SetUrl(url string)
- func (ccf *CommonConfigFields) SetUser(user string)
- type PreRequestInterceptorFunc
- type ServiceDetails
- type SshAuthResult
- type TokenPayload
Constants ¶
View Source
const WaitBeforeRefreshSeconds = 15
Variables ¶
View Source
var RefreshBeforeExpiryMinutes = int64(10)
Refreshable Tokens Constants.
Functions ¶
func ExtractExpiryFromAccessToken ¶
Extracts the expiry from an access token, in seconds
func GetTokenMinutesLeft ¶ added in v0.9.1
Returns 0 if expired
func IsEncrypted ¶
func SshAuthentication ¶
func SshTokenRefreshPreRequestInterceptor ¶ added in v0.9.1
func SshTokenRefreshPreRequestInterceptor(fields *CommonConfigFields, httpClientDetails *httputils.HttpClientDetails) error
Handles the process of acquiring a new ssh token
Types ¶
type CommonConfigFields ¶
type CommonConfigFields struct { Url string `json:"-"` User string `json:"-"` Password string `json:"-"` ApiKey string `json:"-"` AccessToken string `json:"-"` PreRequestInterceptors []PreRequestInterceptorFunc `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) AppendPreRequestInterceptor ¶ added in v0.9.1
func (ccf *CommonConfigFields) AppendPreRequestInterceptor(interceptor PreRequestInterceptorFunc)
func (*CommonConfigFields) AuthenticateSsh ¶
func (ccf *CommonConfigFields) AuthenticateSsh(sshKeyPath, sshPassphrase string) error
func (*CommonConfigFields) CreateHttpClientDetails ¶
func (ccf *CommonConfigFields) CreateHttpClientDetails() httputils.HttpClientDetails
func (*CommonConfigFields) GetAccessToken ¶
func (ccf *CommonConfigFields) GetAccessToken() string
func (*CommonConfigFields) GetApiKey ¶
func (ccf *CommonConfigFields) GetApiKey() string
func (*CommonConfigFields) GetClientCertKeyPath ¶
func (ccf *CommonConfigFields) GetClientCertKeyPath() string
func (*CommonConfigFields) GetClientCertPath ¶
func (ccf *CommonConfigFields) GetClientCertPath() string
func (*CommonConfigFields) GetPassword ¶
func (ccf *CommonConfigFields) GetPassword() string
func (*CommonConfigFields) GetPreRequestInterceptor ¶ added in v0.9.1
func (ccf *CommonConfigFields) GetPreRequestInterceptor() []PreRequestInterceptorFunc
func (*CommonConfigFields) GetSshAuthHeaders ¶
func (ccf *CommonConfigFields) GetSshAuthHeaders() map[string]string
func (*CommonConfigFields) GetSshKeyPath ¶
func (ccf *CommonConfigFields) GetSshKeyPath() string
func (*CommonConfigFields) GetSshPassphrase ¶
func (ccf *CommonConfigFields) GetSshPassphrase() string
func (*CommonConfigFields) GetSshUrl ¶
func (ccf *CommonConfigFields) GetSshUrl() string
func (*CommonConfigFields) GetUrl ¶
func (ccf *CommonConfigFields) GetUrl() string
func (*CommonConfigFields) GetUser ¶
func (ccf *CommonConfigFields) GetUser() string
func (*CommonConfigFields) InitSsh ¶ added in v0.10.0
func (ccf *CommonConfigFields) InitSsh() error
func (*CommonConfigFields) IsSshAuthHeaderSet ¶
func (ccf *CommonConfigFields) IsSshAuthHeaderSet() bool
func (*CommonConfigFields) IsSshAuthentication ¶
func (ccf *CommonConfigFields) IsSshAuthentication() bool
func (*CommonConfigFields) RunPreRequestInterceptors ¶ added in v0.9.1
func (ccf *CommonConfigFields) RunPreRequestInterceptors(httpClientDetails *httputils.HttpClientDetails) error
Runs an interceptor before sending a request via the http client
func (*CommonConfigFields) SetAccessToken ¶
func (ccf *CommonConfigFields) SetAccessToken(accessToken string)
func (*CommonConfigFields) SetApiKey ¶
func (ccf *CommonConfigFields) SetApiKey(apiKey string)
func (*CommonConfigFields) SetClientCertKeyPath ¶
func (ccf *CommonConfigFields) SetClientCertKeyPath(certificatePath string)
func (*CommonConfigFields) SetClientCertPath ¶
func (ccf *CommonConfigFields) SetClientCertPath(certificatePath string)
func (*CommonConfigFields) SetPassword ¶
func (ccf *CommonConfigFields) SetPassword(password string)
func (*CommonConfigFields) SetSshAuthHeaders ¶
func (ccf *CommonConfigFields) SetSshAuthHeaders(sshAuthHeaders map[string]string)
func (*CommonConfigFields) SetSshKeyPath ¶
func (ccf *CommonConfigFields) SetSshKeyPath(sshKeyPath string)
func (*CommonConfigFields) SetSshPassphrase ¶
func (ccf *CommonConfigFields) SetSshPassphrase(sshPassphrase string)
func (*CommonConfigFields) SetSshUrl ¶
func (ccf *CommonConfigFields) SetSshUrl(sshUrl string)
func (*CommonConfigFields) SetUrl ¶
func (ccf *CommonConfigFields) SetUrl(url string)
func (*CommonConfigFields) SetUser ¶
func (ccf *CommonConfigFields) SetUser(user string)
type PreRequestInterceptorFunc ¶ added in v0.9.1
type PreRequestInterceptorFunc func(*CommonConfigFields, *httputils.HttpClientDetails) error
Implement this function and append it to create an interceptor that will run pre request in the http client
type ServiceDetails ¶ added in v0.10.0
type ServiceDetails interface { GetUrl() string GetUser() string GetPassword() string GetApiKey() string GetAccessToken() string GetPreRequestInterceptor() []PreRequestInterceptorFunc 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) AppendPreRequestInterceptor(PreRequestInterceptorFunc) 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 InitSsh() error RunPreRequestInterceptors(httpClientDetails *httputils.HttpClientDetails) error CreateHttpClientDetails() httputils.HttpClientDetails }
type SshAuthResult ¶
type TokenPayload ¶
Click to show internal directories.
Click to hide internal directories.