Documentation
¶
Overview ¶
TODO: This package should be abstracted out to projectdiscovery/utils so it can be shared between httpx, nuclei, and other tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoSecrets = fmt.Errorf("no secrets in given provider")
)
Functions ¶
This section is empty.
Types ¶
type AuthProvider ¶
type AuthProvider interface {
// LookupAddr looks up a given domain/address and returns appropriate auth strategy
// for it (accepted inputs are scanme.sh or scanme.sh:443)
LookupAddr(string) []authx.AuthStrategy
// LookupURL looks up a given URL and returns appropriate auth strategy
// it accepts a valid url struct and returns the auth strategy
LookupURL(*url.URL) []authx.AuthStrategy
// LookupURLX looks up a given URL and returns appropriate auth strategy
// it accepts pd url struct (i.e urlutil.URL) and returns the auth strategy
LookupURLX(*urlutil.URL) []authx.AuthStrategy
}
AuthProvider is an interface for auth providers It implements a data structure suitable for quick lookup and retrieval of auth strategies
func NewAuthProvider ¶
func NewAuthProvider(options *AuthProviderOptions) (AuthProvider, error)
NewAuthProvider creates a new auth provider from the given options
func NewFileAuthProvider ¶
func NewFileAuthProvider(path string) (AuthProvider, error)
NewFileAuthProvider creates a new file based auth provider
func NewMultiAuthProvider ¶
func NewMultiAuthProvider(providers ...AuthProvider) AuthProvider
NewMultiAuthProvider creates a new multi auth provider
type AuthProviderOptions ¶
type AuthProviderOptions struct {
// File based auth provider options
SecretsFiles []string
}
AuthProviderOptions contains options for the auth provider
type FileAuthProvider ¶
type FileAuthProvider struct {
Path string
// contains filtered or unexported fields
}
FileAuthProvider is an auth provider for file based auth it accepts a secrets file and returns its provider
func (*FileAuthProvider) LookupAddr ¶
func (f *FileAuthProvider) LookupAddr(addr string) []authx.AuthStrategy
LookupAddr looks up a given domain/address and returns appropriate auth strategy
func (*FileAuthProvider) LookupURL ¶
func (f *FileAuthProvider) LookupURL(u *url.URL) []authx.AuthStrategy
LookupURL looks up a given URL and returns appropriate auth strategy
func (*FileAuthProvider) LookupURLX ¶
func (f *FileAuthProvider) LookupURLX(u *urlutil.URL) []authx.AuthStrategy
LookupURLX looks up a given URL and returns appropriate auth strategy
type MultiAuthProvider ¶
type MultiAuthProvider struct {
Providers []AuthProvider
}
MultiAuthProvider is a convenience wrapper for multiple auth providers it returns the first matching auth strategy for a given domain if there are multiple auth strategies for a given domain, it returns the first one
func (*MultiAuthProvider) LookupAddr ¶
func (m *MultiAuthProvider) LookupAddr(host string) []authx.AuthStrategy
func (*MultiAuthProvider) LookupURL ¶
func (m *MultiAuthProvider) LookupURL(u *url.URL) []authx.AuthStrategy
func (*MultiAuthProvider) LookupURLX ¶
func (m *MultiAuthProvider) LookupURLX(u *urlutil.URL) []authx.AuthStrategy