auth

package
Version: v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: AGPL-3.0 Imports: 31 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogRequests added in v1.18.0

func LogRequests(log *zap.Logger, h http.Handler) http.Handler

LogRequests logs requests.

func LogResponses added in v1.18.0

func LogResponses(log *zap.Logger, h http.Handler) http.Handler

LogResponses logs responses.

func OpenKV

func OpenKV(ctx context.Context, log *zap.Logger, config Config) (_ authdb.KV, err error)

OpenKV opens the database connection with the appropriate driver.

Types

type Config

type Config struct {
	Endpoint          string        `help:"Gateway endpoint URL to return to clients" default:""`
	AuthToken         string        `help:"auth security token to validate requests" releaseDefault:"" devDefault:""`
	POSTSizeLimit     memory.Size   `help:"maximum size that the incoming POST request body with access grant can be" default:"4KiB"`
	AllowedSatellites []string      `help:"list of satellite NodeURLs allowed for incoming access grants" default:"https://www.storj.io/dcs-satellites"`
	CacheExpiration   time.Duration `help:"length of time satellite addresses are cached for" default:"10m"`

	KVBackend string `help:"key/value store backend url" default:""`
	Migration bool   `help:"create or update the database schema, and then continue service startup" default:"false"`

	ListenAddr    string `user:"true" help:"public HTTP address to listen on" default:":20000"`
	ListenAddrTLS string `user:"true" help:"public HTTPS address to listen on" default:":20001"`

	DRPCListenAddr    string `user:"true" help:"public DRPC address to listen on" default:":20002"`
	DRPCListenAddrTLS string `user:"true" help:"public DRPC+TLS address to listen on" default:":20003"`

	LetsEncrypt bool   `user:"true" help:"use lets-encrypt to handle TLS certificates" default:"false"`
	CertFile    string `user:"true" help:"server certificate file" default:""`
	KeyFile     string `user:"true" help:"server key file" default:""`
	PublicURL   string `user:"true" help:"public url for the server, for the TLS certificate" devDefault:"http://localhost:20000" releaseDefault:""`

	DeleteUnused DeleteUnusedConfig

	Node          badgerauth.Config
	NodeMigration badgerauthmigration.Config
}

Config holds authservice's configuration.

type DeleteUnusedConfig

type DeleteUnusedConfig struct {
	Run                bool          `help:"whether to run unused records deletion chore" default:"false"`
	Interval           time.Duration `help:"interval unused records deletion chore waits to start next iteration" default:"24h"`
	AsOfSystemInterval time.Duration `help:"the interval specified in AS OF SYSTEM in unused records deletion chore query as negative interval" default:"5s"`
	SelectSize         int           `help:"batch size of records selected for deletion at a time" default:"10000"`
	DeleteSize         int           `help:"batch size of records to delete from selected records at a time" default:"1000"`
}

DeleteUnusedConfig is a config struct for configuring unused records deletion chores.

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

Peer is the representation of authservice.

func New

func New(ctx context.Context, log *zap.Logger, config Config, configDir string) (*Peer, error)

New constructs new Peer.

TODO(artur): New and constructors, in general, shouldn't take context.Context as a parameter.

func (*Peer) Address added in v1.37.0

func (p *Peer) Address() string

Address returns the address of the HTTP listener.

func (*Peer) AddressTLS added in v1.37.0

func (p *Peer) AddressTLS() string

AddressTLS returns the address of the HTTPS listener.

func (*Peer) Close

func (p *Peer) Close() error

Close closes all authservice's resources. It does not shut down servers that started serving in Run(). To do that, the context must be canceled. Close will also close any listeners that may still be listening but haven't been closed yet. Run() will take care of closing listeners if the context is canceled, but closing them here is necessary if Run() was never called.

func (*Peer) DRPCAddress added in v1.37.0

func (p *Peer) DRPCAddress() string

DRPCAddress returns the address of the DRPC listener.

func (*Peer) DRPCTLSAddress added in v1.37.0

func (p *Peer) DRPCTLSAddress() string

DRPCTLSAddress returns the address of the DRPC+TLS listener.

func (*Peer) Run

func (p *Peer) Run(ctx context.Context) (err error)

Run starts authservice. It is also responsible for shutting servers down when the context is canceled.

func (*Peer) ServeDRPC added in v1.17.0

func (p *Peer) ServeDRPC(ctx context.Context, listener net.Listener) error

ServeDRPC starts serving DRPC clients.

func (*Peer) ServeHTTP added in v1.17.0

func (p *Peer) ServeHTTP(ctx context.Context, listener net.Listener) (err error)

ServeHTTP starts serving HTTP clients.

type TLSInfo

type TLSInfo struct {
	LetsEncrypt bool
	CertFile    string
	KeyFile     string
	PublicURL   string
	ConfigDir   string
}

TLSInfo is a struct to handle the preferred/configured TLS options.

Source Files

Directories

Path Synopsis
badgerauthmigration
Package badgerauthmigration helps move to badgerauth from sqlauth.
Package badgerauthmigration helps move to badgerauth from sqlauth.
badgerauthtest
Package badgerauthtest is roughly inspired by the design of the storj/satellite/metabase/metabasetest package.
Package badgerauthtest is roughly inspired by the design of the storj/satellite/metabase/metabasetest package.
pb
Package pb includes protobufs for the badgerauth package.
Package pb includes protobufs for the badgerauth package.
Package drpcauth implements the same functionality as package httpauth but with DRPC as transport.
Package drpcauth implements the same functionality as package httpauth but with DRPC as transport.
dbx

Jump to

Keyboard shortcuts

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