Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAuthType ¶
ParseAuthType converts a string to an auth type validator
func RedactString ¶
RedactString hides sensitive data for logging
Types ¶
type APIKeyAuth ¶
type APIKeyAuth struct {
Key string `json:"key"` // The key name (e.g., "X-API-Key")
Value string `json:"value"` // The key value
Location string `json:"location"` // "header" or "query"
}
APIKeyAuth represents API Key authentication
func NewAPIKeyAuth ¶
func NewAPIKeyAuth(key, value, location string) *APIKeyAuth
NewAPIKeyAuth creates a new API Key authentication provider
func (*APIKeyAuth) Apply ¶
func (a *APIKeyAuth) Apply(req *http.Request) error
Apply adds the API key to the request
func (*APIKeyAuth) Redact ¶
func (a *APIKeyAuth) Redact() AuthProvider
Redact returns a copy with the value redacted
func (*APIKeyAuth) String ¶
func (a *APIKeyAuth) String() string
String returns a human-readable representation
func (*APIKeyAuth) Validate ¶
func (a *APIKeyAuth) Validate() error
Validate checks if the configuration is valid
type AuthProvider ¶
type AuthProvider interface {
// Apply adds authentication to the request
Apply(req *http.Request) error
// Type returns the authentication type identifier
Type() string
// Validate checks if the configuration is valid
Validate() error
// Redact returns a copy with sensitive data hidden (for logging)
Redact() AuthProvider
}
AuthProvider applies authentication to HTTP requests
type BasicAuth ¶
BasicAuth represents HTTP Basic authentication
func NewBasicAuth ¶
NewBasicAuth creates a new Basic authentication provider
func (*BasicAuth) Redact ¶
func (b *BasicAuth) Redact() AuthProvider
Redact returns a copy with password redacted
type BearerAuth ¶
type BearerAuth struct {
Token string `json:"token"`
}
BearerAuth represents Bearer token authentication
func NewBearerAuth ¶
func NewBearerAuth(token string) *BearerAuth
NewBearerAuth creates a new Bearer authentication provider
func (*BearerAuth) Apply ¶
func (b *BearerAuth) Apply(req *http.Request) error
Apply adds the Bearer token to the Authorization header
func (*BearerAuth) Redact ¶
func (b *BearerAuth) Redact() AuthProvider
Redact returns a copy with the token redacted
func (*BearerAuth) String ¶
func (b *BearerAuth) String() string
String returns a human-readable representation
func (*BearerAuth) Validate ¶
func (b *BearerAuth) Validate() error
Validate checks if the token is present