JWT · users
Short-lived session tokens with no refresh token. Logout uses an in-process denylist bounded by token expiry. The signing secret is checked at startup.
Deliberate choices rather than configurable knobs: short sessions, robust secret hashing, global rate limiting at the start of the filter chain and strict owner isolation.
JWTs for people, API keys for systems — never both in the same request. The two filters run above the Spring Security chain; once one authenticates, the other is bypassed.
Short-lived session tokens with no refresh token. Logout uses an in-process denylist bounded by token expiry. The signing secret is checked at startup.
Client identifier and key are sent in dedicated headers. The key is hashed in the database and shown in plain text only once, at creation. Soft revocation preserves traceability.
Strict complexity policy and robust hashing with an adjustable work factor. Passwords are never logged or returned in errors. Initial accounts must change their password at first login.
A refresh token adds security work: storage, device binding, rotation and revocation. It is worthwhile for sessions lasting several days. Short sessions with explicit re-login provide the expected experience with less complexity.
Wrong password, disabled account, revoked API key, expired JWT or denylisted JWT all return the same INVALID_CREDENTIALS body, byte for byte. No response-size oracle and no disclosure of whether an email exists.
Authorisation combines two dimensions: a role (ADMIN or STANDARD for people; SYSTEM is a separate principal) and an owner (user or system). Every request passes a strict equivalence check at the service boundary.
404, not 403. The existence of another owner's resource is not disclosed.An administrator role grants management capabilities, not visibility into other people's data. A common trade-off — admins can read everything — was rejected at design time: confidentiality matters more than troubleshooting convenience.
An administrator can link an API key to a user. The user then gains read-only visibility into resources created by that key. Write actions still require strict owner equality. Credentials are never shared.
Beyond authentication and authorisation, three controls limit the impact of traffic spikes, application errors and misconfiguration.
Short- and long-term buckets can be reconfigured at runtime by an administrator. The limiter runs at the start of the chain, before authentication.
Structured JSON logs. A Logback converter masks patterns resembling secrets or sensitive identifiers. A dedicated regression test replays the streams and fails CI if anything leaks.
Application secrets are checked before the first request. Any missing or invalid value stops the process with a clear message.
Placing the limiter first also protects authentication from automated scans and credential-stuffing attempts. The front door needs protection just as much as the rest of the service.