Auth Service operates on a deny-all model: every route is private by default, and public endpoints must be explicitly listed. Downstream microservices that accept tokens issued by Auth Service should follow the same posture — treat all incoming requests as unauthenticated until a valid, non-expired JWT is presented, then authorize based on the claims embedded in the token. Because the access token is stateless, validation in a downstream service requires only the shared JWT secret, the expected issuer string, and a standard JWT library — no call back to Auth Service is needed per request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ricardomb-tech/auth-service/llms.txt
Use this file to discover all available pages before exploring further.
Sending the token
Clients pass the access token in theAuthorization header using the Bearer scheme:
Validating the JWT
Auth Service signs tokens with HS256 using the secret fromJWT_SECRET_CURRENT. To validate a token in a downstream service:
- Verify the signature using the shared HS256 secret (
JWT_SECRET_CURRENT). - Check the
expclaim — reject tokens whereexpis in the past. - Check the
issclaim — reject tokens whereissis not"auth-service". - Extract claims (
sub,email,roles) for authorization decisions.
401 Unauthorized and do not process the request.
Available claims for authorization
| Claim | Use in downstream services |
|---|---|
sub | Stable UUID identifying the account. Use as the user foreign-key in your data model. |
email | The verified email address. May be used for display or audit logging; not guaranteed to be unique across time if accounts are deleted and re-registered. |
roles | Array of role names. Use for role-based access control. |
iss | Must equal "auth-service". Always validate this to prevent token confusion attacks. |
Roles and access control
Auth Service defines two roles:| Role | Typical use |
|---|---|
USER | Granted to every newly registered account. Allows access to standard user-facing endpoints. |
ADMIN | Elevated privileges for administrative operations. Assigned manually or via provisioning configuration. |
roles claim. An admin account will have "roles": ["USER", "ADMIN"] — the USER role is always included. Your authorization logic should check for the presence of the required role within the array.
Extracting roles in a Java downstream service
The following example shows how to parse theroles claim and build Spring Security GrantedAuthority objects — mirroring exactly how JwtAuthenticationFilter does it in Auth Service itself:
Extracting roles in other languages (pseudocode)
How JwtAuthenticationFilter works (Auth Service reference)
JwtAuthenticationFilter in Auth Service is a OncePerRequestFilter that runs before Spring Security’s UsernamePasswordAuthenticationFilter. Its behavior is a useful reference model:
- Reads the
Authorizationheader. If absent or not starting with"Bearer ", the filter does nothing and passes the request on unauthenticated. - Attempts to parse the token with
JWT_SECRET_CURRENT. If parsing fails withExpiredJwtException, the token is silently dropped (the request proceeds unauthenticated). - If parsing fails for any other reason, it retries with
JWT_SECRET_PREVIOUS(to support zero-downtime secret rotation). If the token is expired against the previous key as well, it is silently dropped. If it fails for any other reason (bad signature, malformed token), the token is dropped and a warning is logged. - On success, builds a
UsernamePasswordAuthenticationTokenfrom thesubclaim (as the principal) and therolesclaim (asGrantedAuthorityobjects, prefixed withROLE_), and sets it on theSecurityContextHolder. - The filter never writes an error response itself. A missing or invalid token simply leaves the request unauthenticated; the downstream
AuthenticationEntryPointissues the401if the matched route requires authentication.
Public vs. protected routes
SecurityConfig defines the list of endpoints that are accessible without a token. All other routes require authentication by default.
The deny-all default means every new route you add to Auth Service (or a downstream service following the same pattern) is automatically private. A route becomes public only when explicitly added to the allow list. This prevents accidental exposure of new endpoints before authorization is wired up.
Content-Type: application/problem+json (RFC 9457).