Documentation
¶
Index ¶
- type AuthExtract
- type AuthStep
- type Authenticator
- func (a *Authenticator) AddProfile(p *Profile)
- func (a *Authenticator) Authenticate(profileName string, vars map[string]string) (*Session, error)
- func (a *Authenticator) AuthenticateProfile(p *Profile, vars map[string]string) (*Session, error)
- func (a *Authenticator) LoadProfile(r io.Reader) (*Profile, error)
- func (a *Authenticator) LoadProfileString(jsonStr string) (*Profile, error)
- type Profile
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthExtract ¶
type AuthExtract struct {
Name string `json:"name"` // variable name to set
Source string `json:"source"` // "body", "header", "cookie", "json"
Regex string `json:"regex,omitempty"`
JSONPath string `json:"json_path,omitempty"`
HeaderName string `json:"header_name,omitempty"`
CookieName string `json:"cookie_name,omitempty"`
// contains filtered or unexported fields
}
AuthExtract extracts values from a response for use in subsequent steps.
type AuthStep ¶
type AuthStep struct {
Method string `json:"method"`
URL string `json:"url"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
Extract []AuthExtract `json:"extract,omitempty"`
Condition string `json:"condition,omitempty"` // HTTP status condition (e.g. "200", "302")
}
AuthStep is one step in the authentication flow.
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator manages authentication profiles and sessions.
func NewAuthenticator ¶
func NewAuthenticator(client *http.Client) *Authenticator
NewAuthenticator creates an authenticator with an HTTP client.
func (*Authenticator) AddProfile ¶
func (a *Authenticator) AddProfile(p *Profile)
AddProfile registers an auth profile for later use.
func (*Authenticator) Authenticate ¶
Authenticate runs an auth profile and returns the resulting session. Variables like {{USER}} and {{PASS}} are substituted from the provided vars.
func (*Authenticator) AuthenticateProfile ¶
AuthenticateProfile runs a profile directly (without pre-registration).
func (*Authenticator) LoadProfile ¶
func (a *Authenticator) LoadProfile(r io.Reader) (*Profile, error)
LoadProfile parses a JSON auth profile definition.
func (*Authenticator) LoadProfileString ¶
func (a *Authenticator) LoadProfileString(jsonStr string) (*Profile, error)
LoadProfileString parses a JSON snippet directly.
type Profile ¶
type Profile struct {
Name string `json:"name"`
Description string `json:"description"`
Variables map[string]string `json:"variables"` // {{USER}}, {{PASS}}, etc.
Steps []AuthStep `json:"steps"`
}
Profile defines a multi-step authentication flow.
func BuiltinBearerToken ¶
BuiltinBearerToken returns a profile that just sets a Bearer token header.
func BuiltinFormLogin ¶
BuiltinFormLogin returns a generic form-based login profile.
func BuiltinOAuth2ClientCredentials ¶
BuiltinOAuth2ClientCredentials returns an OAuth2 client_credentials profile.