Documentation
¶
Overview ¶
Package flags declares the command-line flags that configure a service's authenticators once, so every command reads the same ones and resolves them alike.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticators ¶
type Authenticators struct {
// contains filtered or unexported fields
}
Authenticators is the chain the flags resolve to and what a command says about it: nothing is configured when the chain is empty.
func (Authenticators) Chain ¶
func (a Authenticators) Chain() guard.Chain
Chain is the authenticators in the order a request is asked of them; nil when none is configured, which a service serves open where it may.
func (Authenticators) Configured ¶
func (a Authenticators) Configured() bool
Configured reports whether any authenticator guards the service.
func (Authenticators) Reload ¶
func (a Authenticators) Reload() error
Reload has every authenticator that reads a file read it again, as on SIGHUP; the errors are joined, each file that fails keeping what it held.
func (Authenticators) String ¶
func (a Authenticators) String() string
String names what guards the service for a startup line: the kinds configured, comma-separated, or none.
func (Authenticators) TokenText ¶
func (a Authenticators) TokenText() string
TokenText is the static token as it was given, for a command that prints its configuration; empty without one.
type Options ¶
type Options struct {
// TokenFile is -token-file, the file holding the static bearer token.
TokenFile string
// Token is -token, the static bearer token itself.
Token string
// APIKeys is -api-keys, the file of hashed API key records.
APIKeys string
// Logger hears the API key store's reloads; nil is the default logger.
Logger *slog.Logger
// OIDCIssuer is -oidc-issuer, the OpenID provider whose access tokens are accepted.
OIDCIssuer string
// OIDCAudience is -oidc-audience, what a token's aud must name; "" is Resource.
OIDCAudience string
// OIDCScopeClaim is -oidc-scope-claim, the claim scopes are read from.
OIDCScopeClaim string
// OIDCIntrospect is -oidc-introspect, the RFC 7662 endpoint for opaque tokens.
OIDCIntrospect string
// OIDCClientFile is -oidc-client-file, the introspection client's credential.
OIDCClientFile string
// Resource is the URL the command serves its protected resource at (RFC
// 8707), the audience when -oidc-audience is not given; the command sets it.
Resource string
}
Options is what the authenticator flags resolve to; the zero value configures no authenticator.
func Register ¶
Register declares the authenticator flags on fs; env is the variable the command reads a static token from when no flag names one.