Documentation ¶
Index ¶
- func GetTemplatePathsFromSecretFile(file string) ([]string, error)
- func SupportedAuthTypes() []string
- type AuthFileInfo
- type AuthStrategy
- type AuthType
- type Authx
- type BasicAuthStrategy
- type BearerTokenAuthStrategy
- type Cookie
- type CookiesAuthStrategy
- type Dynamic
- type DynamicAuthStrategy
- type HeadersAuthStrategy
- type KV
- type LazyFetchSecret
- type QueryAuthStrategy
- type Secret
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTemplatePathsFromSecretFile ¶
GetTemplatePathsFromSecretFile reads the template IDs from the secret file
func SupportedAuthTypes ¶
func SupportedAuthTypes() []string
SupportedAuthTypes returns the supported auth types
Types ¶
type AuthFileInfo ¶
type AuthStrategy ¶
type AuthStrategy interface { // Apply applies the strategy to the request Apply(*http.Request) // ApplyOnRR applies the strategy to the retryable request ApplyOnRR(*retryablehttp.Request) }
AuthStrategy is an interface for auth strategies basic auth , bearer token, headers, cookies, query
type Authx ¶
type Authx struct { ID string `json:"id" yaml:"id"` Info AuthFileInfo `json:"info" yaml:"info"` Secrets []Secret `json:"static" yaml:"static"` Dynamic []Dynamic `json:"dynamic" yaml:"dynamic"` }
Authx is a struct for secrets or credentials file
func GetAuthDataFromFile ¶
GetAuthDataFromFile reads the auth data from file
func GetAuthDataFromJSON ¶
GetAuthDataFromJSON reads the auth data from json
func GetAuthDataFromYAML ¶
GetAuthDataFromYAML reads the auth data from yaml
type BasicAuthStrategy ¶
type BasicAuthStrategy struct {
Data *Secret
}
BasicAuthStrategy is a strategy for basic auth
func NewBasicAuthStrategy ¶
func NewBasicAuthStrategy(data *Secret) *BasicAuthStrategy
NewBasicAuthStrategy creates a new basic auth strategy
func (*BasicAuthStrategy) Apply ¶
func (s *BasicAuthStrategy) Apply(req *http.Request)
Apply applies the basic auth strategy to the request
func (*BasicAuthStrategy) ApplyOnRR ¶
func (s *BasicAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the basic auth strategy to the retryable request
type BearerTokenAuthStrategy ¶
type BearerTokenAuthStrategy struct {
Data *Secret
}
BearerTokenAuthStrategy is a strategy for bearer token auth
func NewBearerTokenAuthStrategy ¶
func NewBearerTokenAuthStrategy(data *Secret) *BearerTokenAuthStrategy
NewBearerTokenAuthStrategy creates a new bearer token auth strategy
func (*BearerTokenAuthStrategy) Apply ¶
func (s *BearerTokenAuthStrategy) Apply(req *http.Request)
Apply applies the bearer token auth strategy to the request
func (*BearerTokenAuthStrategy) ApplyOnRR ¶
func (s *BearerTokenAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the bearer token auth strategy to the retryable request
type Cookie ¶
type Cookie struct { Key string `json:"key" yaml:"key"` Value string `json:"value" yaml:"value"` Raw string `json:"raw" yaml:"raw"` }
type CookiesAuthStrategy ¶
type CookiesAuthStrategy struct {
Data *Secret
}
CookiesAuthStrategy is a strategy for cookies auth
func NewCookiesAuthStrategy ¶
func NewCookiesAuthStrategy(data *Secret) *CookiesAuthStrategy
NewCookiesAuthStrategy creates a new cookies auth strategy
func (*CookiesAuthStrategy) Apply ¶
func (s *CookiesAuthStrategy) Apply(req *http.Request)
Apply applies the cookies auth strategy to the request
func (*CookiesAuthStrategy) ApplyOnRR ¶
func (s *CookiesAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the cookies auth strategy to the retryable request
type Dynamic ¶
type Dynamic struct { Secret `yaml:",inline"` // this is a static secret that will be generated after the dynamic secret is resolved TemplatePath string `json:"template" yaml:"template"` Variables []KV `json:"variables" yaml:"variables"` Input string `json:"input" yaml:"input"` // (optional) target for the dynamic secret Extracted map[string]interface{} `json:"-" yaml:"-"` // extracted values from the dynamic secret // contains filtered or unexported fields }
Dynamic is a struct for dynamic secret or credential these are high level secrets that take action to generate the actual secret ex: username and password are dynamic secrets, the actual secret is the token obtained after authenticating with the username and password
func (*Dynamic) Fetch ¶
Fetch fetches the dynamic secret if isFatal is true, it will stop the execution if the secret could not be fetched
func (*Dynamic) GetStrategy ¶
func (d *Dynamic) GetStrategy() AuthStrategy
GetStrategy returns the auth strategy for the dynamic secret
func (*Dynamic) SetLazyFetchCallback ¶
func (d *Dynamic) SetLazyFetchCallback(callback LazyFetchSecret)
SetLazyFetchCallback sets the lazy fetch callback for the dynamic secret
func (*Dynamic) UnmarshalJSON ¶
type DynamicAuthStrategy ¶
type DynamicAuthStrategy struct { // Dynamic is the dynamic secret to use Dynamic Dynamic }
DynamicAuthStrategy is an auth strategy for dynamic secrets it implements the AuthStrategy interface
func (*DynamicAuthStrategy) Apply ¶
func (d *DynamicAuthStrategy) Apply(req *http.Request)
Apply applies the strategy to the request
func (*DynamicAuthStrategy) ApplyOnRR ¶
func (d *DynamicAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the strategy to the retryable request
type HeadersAuthStrategy ¶
type HeadersAuthStrategy struct {
Data *Secret
}
HeadersAuthStrategy is a strategy for headers auth
func NewHeadersAuthStrategy ¶
func NewHeadersAuthStrategy(data *Secret) *HeadersAuthStrategy
NewHeadersAuthStrategy creates a new headers auth strategy
func (*HeadersAuthStrategy) Apply ¶
func (s *HeadersAuthStrategy) Apply(req *http.Request)
Apply applies the headers auth strategy to the request
func (*HeadersAuthStrategy) ApplyOnRR ¶
func (s *HeadersAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the headers auth strategy to the retryable request
type LazyFetchSecret ¶
type QueryAuthStrategy ¶
type QueryAuthStrategy struct {
Data *Secret
}
QueryAuthStrategy is a strategy for query auth
func NewQueryAuthStrategy ¶
func NewQueryAuthStrategy(data *Secret) *QueryAuthStrategy
NewQueryAuthStrategy creates a new query auth strategy
func (*QueryAuthStrategy) Apply ¶
func (s *QueryAuthStrategy) Apply(req *http.Request)
Apply applies the query auth strategy to the request
func (*QueryAuthStrategy) ApplyOnRR ¶
func (s *QueryAuthStrategy) ApplyOnRR(req *retryablehttp.Request)
ApplyOnRR applies the query auth strategy to the retryable request
type Secret ¶
type Secret struct { Type string `json:"type" yaml:"type"` Domains []string `json:"domains" yaml:"domains"` DomainsRegex []string `json:"domains-regex" yaml:"domains-regex"` Headers []KV `json:"headers" yaml:"headers"` Cookies []Cookie `json:"cookies" yaml:"cookies"` Params []KV `json:"params" yaml:"params"` Username string `json:"username" yaml:"username"` // can be either email or username Password string `json:"password" yaml:"password"` Token string `json:"token" yaml:"token"` // Bearer Auth token // contains filtered or unexported fields }
Secret is a struct for secret or credential
func (*Secret) GetStrategy ¶
func (s *Secret) GetStrategy() AuthStrategy
GetStrategy returns the auth strategy for the secret