Authentication and capabilities
Understand SmartGare's own sign-in, the one issuer the API trusts, backend authorization, browser sessions, and MCP permissions.
SmartGare separates identity from authorization.
Authentication
The backend is a stateless OAuth2 resource server. It validates the JWT issuer, signature, and expiry and creates no application session.
SmartGare runs its own sign-in service (Spring Security's authorization
server, in the identity module). It hands out every badge: to people, to the
apps and to the machine accounts the services use between themselves. It holds
the emergency administrator, the list of people with their roles, and each
account's optional second step (authenticator app, security key or passkey,
backup codes).
- The API trusts exactly one issuer.
JWT_ISSUER_URInames it; the API trusts SmartGare when that is the address SmartGare's sign-in names (SIGN_IN_ISSUER). A badge from any other issuer, Keycloak's included, is refused. Roles come only from SmartGare'srolesclaim. - A person's badge is checked against SmartGare's list. A badge issued
before the person's latest password change, reset or suspension is refused
within five seconds (
JWT_GENERATION_RECHECK) on every copy. Machine badges are accepted without that check. - An outside provider is optional. Keycloak, or any OpenID Connect provider, can be linked behind SmartGare's sign-in from the console (Administration → Connexion), never through environment variables. It only proves who a person is; SmartGare decides their roles. Swapping or removing it changes no app, service or machine account.
- Locally there is no Keycloak. The server's
localprofile runs the sign-in service athttp://localhost:8080and makes the API trust it. Deployments keep the issuer they name until they move over.
The decision record is ADR-0053 — SmartGare is the only issuer the API trusts
in smartgare-services. First start, the administrator, recovery, linking a
provider and moving a station over are in
First sign-in and the administrator.
Authorization
Permissions use stable capability names:
referential.carrier:read
referential.carrier:write
referential.vehicle:import-permits
referential.vehicle:trigger-expiry-watch
siv.display-point:write
referential.rule:readHTTP handlers and MCP tools declare the permission they require. Architecture tests fail when a new operation is unguarded.
Frontend sessions
Each app's server runs a standard OIDC session against the one sign-in
address it is given (OIDC_AUTHORITY) and finds every other address through
the issuer's discovery document. Bearer and refresh tokens remain in HTTP-only
cookies and server-side code.
Capability bootstrap responses let applications hide or disable unavailable controls. They never replace backend enforcement.
Public paths
Actuator health/info and API documentation are public by configuration. Every other path requires authentication unless explicitly allowlisted.
Never expose a credential
Do not place access tokens, refresh tokens, client secrets, connection strings, or signed URLs in browser code, documentation, screenshots, logs, or examples.