Documentation ¶
Index ¶
Constants ¶
View Source
const ( //CM login url CMLoginURL = "/api/login" CMAccessTokenExpiration = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
Credentials represent the username and password used for authentication.
type TokenManager ¶
type TokenManager struct { ServerURL string SslInsecure bool TrustedCerts string // contains filtered or unexported fields }
TokenManager is responsible for managing the authentication token.
func NewTokenManager ¶
func NewTokenManager(serverURL string, credentials Credentials, trustedCerts string, sslInsecure bool) *TokenManager
NewTokenManager creates a new instance of TokenManager.
func (*TokenManager) FetchToken ¶
func (tm *TokenManager) FetchToken() error
FetchToken retrieves a new token from the CM.
func (*TokenManager) GetToken ¶
func (tm *TokenManager) GetToken() string
GetToken returns the current valid saved token.
func (*TokenManager) SyncToken ¶
func (tm *TokenManager) SyncToken(stopCh chan struct{})
SyncToken maintains valid token. It fetches a new token before expiry.
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` UserID string `json:"user_id"` }
TokenResponse represents the response received from the CM.
Click to show internal directories.
Click to hide internal directories.