Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiKeyAuth ¶
type ApiKeyAuth struct {
AuthType AuthType `json:"auth_type"`
APIKey string `json:"api_key"` // If it starts with '$', treated as injected variable.
VarName string `json:"var_name"` // Header/query param/cookie name (default: "X-Api-Key").
Location string `json:"location"` // Where to include the key: header, query, or cookie.
}
ApiKeyAuth holds config for API key–based authentication.
The key can be provided directly or sourced from an environment variable.
func NewApiKeyAuth ¶
func NewApiKeyAuth(apiKey string) *ApiKeyAuth
NewApiKeyAuth constructs an ApiKeyAuth with defaults.
func (*ApiKeyAuth) Validate ¶
func (a *ApiKeyAuth) Validate() error
Validate ensures required fields are present.
type Auth ¶
type Auth interface {
// Type returns the authentication type.
Type() AuthType
// Validate checks that all required fields are set.
Validate() error
}
Auth is the interface all auth methods implement.
func UnmarshalAuth ¶ added in v1.4.6
type BasicAuth ¶
type BasicAuth struct {
AuthType AuthType `json:"auth_type"`
Username string `json:"username"`
Password string `json:"password"`
}
BasicAuth holds config for HTTP Basic authentication.
func NewBasicAuth ¶
NewBasicAuth constructs a BasicAuth.
type OAuth2Auth ¶
type OAuth2Auth struct {
AuthType AuthType `json:"auth_type"`
TokenURL string `json:"token_url"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Scope *string `json:"scope,omitempty"` // Optional OAuth2 scope.
}
OAuth2Auth holds config for OAuth2 authentication.
func NewOAuth2Auth ¶
func NewOAuth2Auth(tokenURL, clientID, clientSecret string, scope *string) *OAuth2Auth
NewOAuth2Auth constructs an OAuth2Auth.
func (*OAuth2Auth) Validate ¶
func (o *OAuth2Auth) Validate() error
Validate ensures required fields are present.
Click to show internal directories.
Click to hide internal directories.