Documentation
¶
Overview ¶
Package auth covers auth for reaching injection points behind login gates: basic, digest, NTLM, bearer, cookie/form login, and CSRF extraction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Type AuthType
Credentials string // format depends on type
LoginURL string // form auth
LoginData string // form auth
CheckURL string // verify login success
CheckString string // text proving success
CSRFTokenName string
CSRFURL string
}
Config configures the authentication handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler tracks auth state: logins, cookies, CSRF tokens, and re-auth.
func New ¶
func New(cfg Config, client *httpclient.Client) *Handler
New builds a Handler from a config and an httpclient.
func (*Handler) Apply ¶
Apply adds the appropriate authentication to an outgoing request. For header-based auth it injects the Authorization header; for form auth it injects session cookies; for digest/NTLM it performs the challenge dance.
func (*Handler) FetchCSRFToken ¶
FetchCSRFToken retrieves a fresh CSRF token from the configured CSRF URL. It supports token extraction from HTML form hidden inputs, HTML meta tags, or JSON responses (by name lookup in a JSON object).
func (*Handler) LastCSRFToken ¶
LastCSRFToken returns the most recently extracted token, if any.