authprovider

package
v3.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
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
	// GetTemplatePaths returns the template path for the auth provider
	// that will be used for dynamic secret fetching
	GetTemplatePaths() []string
	// PreFetchSecrets pre-fetches the secrets from the auth provider
	// instead of lazy fetching
	PreFetchSecrets() error
}

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, callback authx.LazyFetchSecret) (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
	// LazyFetchSecret is a callback for lazy fetching of dynamic secrets
	LazyFetchSecret authx.LazyFetchSecret
}

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) GetTemplatePaths

func (f *FileAuthProvider) GetTemplatePaths() []string

GetTemplatePaths returns the template path for the auth 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

func (*FileAuthProvider) PreFetchSecrets

func (f *FileAuthProvider) PreFetchSecrets() error

PreFetchSecrets pre-fetches the secrets from the auth provider

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) GetTemplatePaths

func (m *MultiAuthProvider) GetTemplatePaths() []string

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

func (*MultiAuthProvider) PreFetchSecrets

func (m *MultiAuthProvider) PreFetchSecrets() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL