Documentation
¶
Index ¶
- Constants
- func ClearProcessTokenCache()
- func ExtractTokenInfo(responseBody []byte, isBasicAuth bool) (string, int, error)
- func FormatTokenForHeaders(token string, expiresIn int, tokenType string, isBasicAuth bool) []byte
- func GetTokenForRequest(profileName string, profile models.Profile, settings models.Settings) (string, error)
- func IsCI() bool
- type AuthResult
- type Authenticator
- type TokenInfo
- type TokenManager
- func (tm *TokenManager) AuthenticateWithSettings(profile models.Profile, username, password, apiURL string, insecure bool) (string, int, error)
- func (tm *TokenManager) DeleteToken(profileName string) error
- func (tm *TokenManager) GetToken(profileName string, profile models.Profile, username, password, apiURL string, ...) (string, error)
- func (tm *TokenManager) StoreToken(profileName, token string, expiresIn int) error
Constants ¶
const ( KeyringService = "owlctl" TokenEnvVar = "OWLCTL_TOKEN" )
Variables ¶
This section is empty.
Functions ¶
func ClearProcessTokenCache ¶ added in v1.2.0
func ClearProcessTokenCache()
ClearProcessTokenCache resets the in-process token cache. Used when switching instances mid-process (e.g., multi-instance group operations).
func ExtractTokenInfo ¶
ExtractTokenInfo parses token from OAuth response body (for legacy compatibility)
func FormatTokenForHeaders ¶
FormatTokenForHeaders formats token for headers.json (legacy format)
func GetTokenForRequest ¶
func GetTokenForRequest(profileName string, profile models.Profile, settings models.Settings) (string, error)
GetTokenForRequest is a convenience function for API requests that handles credential gathering from settings/env and token resolution. Returns the token string or an error.
Types ¶
type AuthResult ¶
AuthResult contains authentication response
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator handles API authentication
func NewAuthenticator ¶
func NewAuthenticator(insecure bool, debug bool) *Authenticator
NewAuthenticator creates a new authenticator
func (*Authenticator) Authenticate ¶
func (a *Authenticator) Authenticate(profile models.Profile, username, password, apiURL string) (*AuthResult, error)
Authenticate performs OAuth or Basic Auth login
type TokenInfo ¶
type TokenInfo struct {
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
IssuedAt time.Time `json:"issued_at"`
Profile string `json:"profile"`
}
TokenInfo holds token metadata
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
TokenManager handles token storage and retrieval
func NewTokenManager ¶
func NewTokenManager(debug bool) (*TokenManager, error)
NewTokenManager creates a new token manager
func (*TokenManager) AuthenticateWithSettings ¶
func (tm *TokenManager) AuthenticateWithSettings(profile models.Profile, username, password, apiURL string, insecure bool) (string, int, error)
AuthenticateWithSettings performs OAuth login with settings context
func (*TokenManager) DeleteToken ¶
func (tm *TokenManager) DeleteToken(profileName string) error
DeleteToken removes a token from keychain
func (*TokenManager) GetToken ¶
func (tm *TokenManager) GetToken(profileName string, profile models.Profile, username, password, apiURL string, insecure bool) (string, error)
GetToken retrieves token using hybrid approach Priority: 1) OWLCTL_TOKEN env var, 2) keychain, 3) auto-authenticate profileName is used for keychain storage/retrieval
func (*TokenManager) StoreToken ¶
func (tm *TokenManager) StoreToken(profileName, token string, expiresIn int) error
StoreToken stores a token in the system keychain