Documentation
¶
Overview ¶
Package auth provides authentication utilities for the AhaSend CLI.
This package handles client authentication through multiple methods:
- Global API key flags (--api-key and --account-id)
- Profile-based authentication from configuration files
- Profile switching and validation
The main function GetAuthenticatedClient creates authenticated clients for use by CLI commands, handling the authentication precedence and validation automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthenticatedClient ¶
func GetAuthenticatedClient(cmd *cobra.Command) (client.AhaSendClient, error)
GetAuthenticatedClient returns an authenticated AhaSend client It checks for global flags first, then falls back to profiles
func RequireAuth ¶
RequireAuth validates that authentication is available
func SetAuthenticatedClientResolverForTesting ¶
func SetAuthenticatedClientResolverForTesting(resolver ClientResolver) func()
SetAuthenticatedClientResolverForTesting overrides authenticated client resolution for tests.
Types ¶
type ClientResolver ¶
type ClientResolver func(*cobra.Command) (client.AhaSendClient, error)
ClientResolver resolves an authenticated AhaSend client for a command.
Click to show internal directories.
Click to hide internal directories.