pub struct JwtSection {
pub secret: String,
pub secret_file: Option<String>,
pub expiration_minutes: u64,
}Expand description
JWT authentication section.
appsettings keys are PascalCase: Jwt.Secret and Jwt.ExpirationMinutes
(or APP__Jwt__ExpirationMinutes). ExpirationMinutes drives the lifetime
of tokens minted by the default ITokenIssuer that
HostBuilder::add_authentication() registers.
§Where the signing secret comes from (XR-2)
First non-empty source wins, evaluated at host startup:
APP__Jwt__Secret/JWT_SECRETenv vars — applied over the JSON duringload_appsettings, so they arrive here asSecret;Jwt.Secretinappsettings.json(or a code-leveluseOptionsoverride);Jwt.SecretFile— a path to a file holding the secret, read byrust_webx_host::auth_jwt::apply_jwt_secret_file. The file must be at least 32 bytes of non-whitespace content and, on Unix, must not grant group/other permissions (chmod 600); a missing, unreadable, too short or over-permissive file fails host startup instead of running with a broken key.
Fields§
§secret: StringHMAC secret for signing/verifying JWT tokens.
secret_file: Option<String>Optional path to a file holding the HMAC secret.
Only used when Secret is empty, so an explicit secret (env or JSON)
always wins and existing appsettings keep working unchanged. The
framework does not create the file: provisioning the secret is an
operator/installer concern. DPAPI-wrapped secrets are not supported by
this release.
expiration_minutes: u64Lifetime of freshly issued tokens, in minutes. Default: 60.
0 falls back to the default: a zero lifetime would only mint tokens
that are already expired.