v1.65.0 Latest Latest

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

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 29 Imported by: 0




This section is empty.


This section is empty.


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 OpenStorage added in v1.65.0

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

OpenStorage opens the underlying storage for Auth Service's database, determining the backend based on the connection string.


type Config

type Config struct {
	Endpoint          string        `help:"Gateway endpoint URL to return to clients" default:""`
	AuthToken         []string      `help:"auth security token(s) 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:""`
	CacheExpiration   time.Duration `help:"length of time satellite addresses are cached for" default:"10m"`
	ShutdownDelay     time.Duration `help:"time to delay server shutdown while returning 503s on the health endpoint" devDefault:"1s" releaseDefault:"45s"`

	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"`

	CertFile  string   `user:"true" help:"server certificate file" default:""`
	KeyFile   string   `user:"true" help:"server key file" default:""`
	PublicURL []string `` /* 147-byte string literal not displayed */

	CertMagic certMagic

	Node badgerauth.Config

Config holds authservice's configuration.

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 {
	CertFile   string
	KeyFile    string
	PublicURL  []string
	ConfigDir  string
	ListenAddr string

	// CertMagic obtains and renews TLS certificates and staples OCSP responses
	// Setting this to true will mean the server obtains certificate through Certmagic
	// CertFile and KeyFile options will NOT be considered.
	CertMagic bool

	// CertMagicKeyFile is a path to a file containing the CertMagic service account key.
	CertMagicKeyFile string

	// CertMagicEmail is the email address to use when creating an ACME account
	CertMagicEmail string

	// CertMagicStaging use staging CA endpoints
	CertMagicStaging bool

	// CertMagicBucket bucket to use for certstorage
	CertMagicBucket string

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


Path Synopsis
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.
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.

Jump to

Keyboard shortcuts

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