Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
Secrets SecretsConfig `mapstructure:"secrets"`
Issuer IssuerConfig `mapstructure:"issuer"`
Session SessionConfig `mapstructure:"session"`
Keystore KeystoreConfig `mapstructure:"keystore"`
TokenExchange TokenExchangeConfig `mapstructure:"token_exchange"`
Gateway GatewayConfig `mapstructure:"gateway"`
}
func Load ¶
Load reads configuration for the authorization server (`legant serve`), which requires the full secret set.
func LoadGateway ¶
LoadGateway reads configuration for the MCP auth-gateway (`legant gateway`), which does not need the Fosite system or cookie secrets.
func LoadMinimal ¶
LoadMinimal reads configuration for commands that only touch the database (migrations, maintenance/retention) and therefore require none of the secrets.
type DatabaseConfig ¶
type GatewayConfig ¶
type GatewayConfig struct {
Upstreams []UpstreamConfig `mapstructure:"upstreams"`
// DownstreamTTL caps the lifetime of the fresh per-call token the gateway mints
// for an upstream (still clamped to the inbound token's expiry). Default 60s.
DownstreamTTL time.Duration `mapstructure:"downstream_ttl"`
// RevocationRefresh selects the revocation-check mode. 0 (default) = check the
// store per call (Tier A, instant). >0 = keep an in-memory set of revoked,
// unexpired token ids refreshed on this interval (Tier B, avoids a per-call DB
// read for high-QPS gateways; a revoke then takes effect within the interval).
RevocationRefresh time.Duration `mapstructure:"revocation_refresh"`
}
GatewayConfig configures `legant gateway` — the MCP auth-gateway mode.
type IssuerConfig ¶
type IssuerConfig struct {
URL string `mapstructure:"url"`
}
type KeystoreConfig ¶
type SecretsConfig ¶
type SecretsConfig struct {
System string `mapstructure:"system"` // 32+ bytes, Fosite global HMAC secret
Cookie string `mapstructure:"cookie"` // 32+ bytes, cookie signing
// KeyEncryption is the master key used to envelope-encrypt signing keys at
// rest. If empty it is derived from System via HKDF (domain-separated), so
// dev works out of the box; production should set a distinct value so the
// at-rest key is not the same material as the Fosite HMAC secret.
KeyEncryption string `mapstructure:"key_encryption"`
}
func (SecretsConfig) KeyEncryptionMaterial ¶
func (s SecretsConfig) KeyEncryptionMaterial() ([]byte, error)
KeyEncryptionMaterial returns the 32-byte key used to encrypt signing keys at rest: the explicit KeyEncryption secret if set, otherwise an HKDF-derived subkey of System with a fixed domain-separation label.
type ServerConfig ¶
type ServerConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
// LiveIngestToken, when set, enables POST /admin/live/ingest: a shared secret a
// connected resource server (e.g. a `legant guard` hook) presents to stream its
// allow/deny decisions into the /admin/live console. Empty disables the endpoint.
LiveIngestToken string `mapstructure:"live_ingest_token"`
}
func (ServerConfig) Addr ¶
func (s ServerConfig) Addr() string