Documentation
¶
Overview ¶
Package auth provides authentication handling for accessibility audits.
Index ¶
- type AuthType
- type Config
- type Cookie
- type FormSelectors
- type Handler
- func (h *Handler) Authenticate(ctx context.Context) error
- func (h *Handler) GetSessionCookies(ctx context.Context) ([]Cookie, error)
- func (h *Handler) HandleMFA(ctx context.Context, mfaCode string) error
- func (h *Handler) IsAuthenticated(ctx context.Context) bool
- func (h *Handler) RestoreSession(ctx context.Context, session *Session) error
- func (h *Handler) SaveSession(ctx context.Context) (*Session, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Type of authentication
Type AuthType `yaml:"type" json:"type"`
// Login URL (for form auth)
LoginURL string `yaml:"loginUrl,omitempty" json:"loginUrl,omitempty"`
// Credentials
Credentials map[string]string `yaml:"credentials,omitempty" json:"credentials,omitempty"`
// Form selectors (for form auth)
Selectors *FormSelectors `yaml:"selectors,omitempty" json:"selectors,omitempty"`
// Headers (for bearer/basic auth)
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
// Cookies (for cookie auth)
Cookies map[string]string `yaml:"cookies,omitempty" json:"cookies,omitempty"`
// Success indicator (selector that indicates successful login)
SuccessIndicator string `yaml:"successIndicator,omitempty" json:"successIndicator,omitempty"`
// Timeout for login
Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}
Config contains authentication configuration.
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Domain string `json:"domain,omitempty"`
Path string `json:"path,omitempty"`
Secure bool `json:"secure,omitempty"`
HttpOnly bool `json:"httpOnly,omitempty"`
}
Cookie represents a browser cookie.
type FormSelectors ¶
type FormSelectors struct {
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
Submit string `yaml:"submit" json:"submit"`
MFA string `yaml:"mfa,omitempty" json:"mfa,omitempty"`
}
FormSelectors contains CSS selectors for form-based authentication.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles authentication for audits.
func NewHandler ¶
NewHandler creates a new authentication handler.
func (*Handler) Authenticate ¶
Authenticate performs authentication based on the configured method.
func (*Handler) GetSessionCookies ¶
GetSessionCookies returns current session cookies.
func (*Handler) IsAuthenticated ¶
IsAuthenticated checks if the session is authenticated.
func (*Handler) RestoreSession ¶
RestoreSession restores a saved session.
Click to show internal directories.
Click to hide internal directories.