First sign-in and the administrator
Start SmartGare locally with no Keycloak, sign in as the administrator with the bootstrap password, win it back from the machine, link a provider, and move a station over from Keycloak.
SmartGare runs its own sign-in service. On day one it holds a single
administrator, admin, named after its role. Its first password is a one-time
bootstrap password, and the first sign-in always replaces it. See
Authentication for how the API trusts
that service.
First start on your machine
Start everything
From the workspace folder that holds the repositories:
make devIt starts PostgreSQL, Redis, Kafka, Mailpit and the document store (never
Keycloak), the all-in-one server on http://localhost:8080 and the back
office, supervision and counter apps. The server's local profile turns
SmartGare's sign-in on at http://localhost:8080, makes the API trust it and
registers each app with a development-only secret: no environment variable
to set. Anything already running is reused, never restarted.
Sign in as admin
Open http://localhost:5101/console. The console sends you to SmartGare's
sign-in page; sign in as admin with the bootstrap password admin.
Set a new password
Nothing else opens before you choose your own password: 12 to 64 characters with letters and digits, never the bootstrap password. From then on the bootstrap password is refused.
Add a second step, or later
The page then offers a second step, optional for everyone, the administrator included; « Plus tard » skips it:
- « Application d'authentification »: scan the QR code, then type one code;
- « Clé de sécurité »: a security key such as a YubiKey, or a passkey, with one touch.
With the first device come ten backup codes, shown once. Keep them: each stands in for a lost device once.
The bootstrap password
On every deployment the first sign-in is admin with the bootstrap password:
BOOTSTRAP_PASSWORD when the installer sets it before the very first start (12
to 64 characters, letters and digits), otherwise admin. A new password is
chosen at that first sign-in, once, at install. A later start never changes the
administrator, whatever the settings then say.
Good to know
- Guess limit. After five wrong passwords in a row for one identifier, it is paused for one minute, doubled at each further failure up to fifteen minutes, never locked for good (« Trop d'essais, réessayez dans N minutes »). Wrong codes and keys are counted the same way, apart from passwords.
- Second step. Optional for everyone. Whoever has one is asked for it at every sign-in; removing the last device turns it off.
- Account security page. The second step, its devices and the backup codes
are managed on « Sécurité du compte », on the sign-in service itself:
http://localhost:8080/login/accountlocally. It asks for the password (and the second step, if any) again when older than five minutes. The console's « Mon compte » links to it. - Emergency account.
adminalways signs in on SmartGare's own form, never through a linked provider. Every sign-in raises a supervision alert and an audit record. It cannot be deleted or suspended from the console.
Lost administrator
A lost administrator is won back only from the server's machine, never over the network: no page, API or e-mail offers it. Backup codes replace a lost device, never a lost password.
In a shell on the machine, or opened into the running server's (or identity service's) container:
server-start.sh reset-administratorIt is a small program: it starts no web server and changes no database structure. It:
- removes the administrator's password, every device and backup code, ends its sessions and revokes every badge an app holds for it;
- writes a new one-time bootstrap password into a file on the machine,
readable by the server's own user only (
BOOTSTRAP_PASSWORD_FILE,~/.smartgare/bootstrap-passwordby default); it never appears in a log; - raises a supervision alert and an audit record.
The next sign-in then works as on day one: bootstrap password, then a new
password, then the offer of a second step. server-start.sh ships in every server image; on
your own machine, starting again from an empty database is simpler.
| Exit code | Meaning |
|---|---|
0 | Reset; the new bootstrap password is in the file |
2 | Refused: the sign-in service is off on this deployment |
3 | Nothing to reset: no administrator yet (start the server once) |
4 | Reset, but the file could not be written; fix the folder and run it again (it draws a new one) |
5 | Refused: the file's folder is not writable by the server's own user |
6 | Refused: another reset is running |
Linking a provider
Keycloak, or any standard OpenID Connect provider, is linked from the console: Administration → Connexion, by the administrator only. Never through environment variables. One provider at a time.
- Fill in the button name, the provider's issuer address, client id, secret
and, optionally, the scopes. On the provider's side, allow SmartGare's
return address:
<sign-in address>/login/oauth2/code/provider. - Press « Tester ». Nothing is saved; the page answers in one French sentence whether the provider answers at that address, names itself with it, and accepts the client id and secret.
- « Enregistrer » opens only once the test of those exact values passed. When the answer is « Adresse joignable, identifiants non vérifiés », tick the confirmation to save anyway.
The secret is kept sealed and never shown again. « Retirer le fournisseur » unlinks it after a confirmation.
Once linked, the sign-in page shows « Se connecter avec <name> » beside the form. How people are matched:
- SmartGare keeps the list of people and their roles; the provider only proves who someone is.
- A person is found by the e-mail address the provider's signed answer gives and marks as verified, and gets the roles SmartGare gives them. The provider's own second step stands for SmartGare's.
- Refused, with one plain sentence: an address not verified, an address nobody in SmartGare's list holds, a person who signs in with a SmartGare password, a suspended or offboarded person, and the emergency administrator, who never signs in through a provider.
- If the provider is down, the administrator still signs in on the form.
On the people pages, each person signs in either with « Mot de passe SmartGare » or « Fournisseur lié »; switching is its own step.
Locally
The local profile lets you link a Keycloak running on your machine over
plain http, a development-only exception (SIGN_IN_PROVIDER_LOCAL_DEVELOPMENT).
A deployment only reaches a provider over https. To try it, start Keycloak
with make identity in smartgare-services and link
http://localhost:9002/realms/default.
Moving a station from Keycloak
Not yet done on any deployment
The local stack runs SmartGare's sign-in today. The dev environment and every station still trust Keycloak; no move-over has been run on them yet.
A station moves over once, following the steps in the decision record
ADR-0053 — SmartGare is the only issuer the API trusts (smartgare-services,
docs/decisions/). In short:
-
Turn SmartGare's sign-in on where it runs (the server, or the identity service on the eight-service layout):
SIGN_IN_ENABLED=true,SIGN_IN_ISSUER(its public address),SIGN_IN_KEY_ENCRYPTION_SECRET,BOOTSTRAP_PASSWORDif wanted (otherwiseadmin), the machine accounts' secrets and each app's return addresses. -
Sign in as the administrator with the bootstrap password, then copy the people over in a shell on the machine, with the Keycloak admin settings still set:
server-start.sh move-over-from-keycloakEvery person of the realm with an e-mail address is added with the station's roles they hold there, signing in through the linked provider. Anyone already in the list is left unchanged, so a second run changes nothing. It prints who was copied, left unchanged, left out or refused, and Keycloak's machine clients (set as SmartGare machine accounts in step 1, never copied). Exit
0done,2the sign-in service is off,3Keycloak could not be read. Then link Keycloak on the Connexion page. -
Point every application at it:
SIGN_IN_ISSUERandJWT_ISSUER_URIset to the same address; remove any role-claims setting. -
Give the dedicated services their badges from it through the switchboard's identity settings (issuer,
smartgare-servicesclient and its secret). -
Point the apps at it (frontend
OIDC_AUTHORITY) and restart everything. Everyone signs in again once.