feat(auth): optional Ever ID sign-in provider (OpenID Connect)
What
An optional sign-in provider everid: Continue with Ever ID, next to email and password, API clients and Google. It works with Ever ID and with any other OpenID Connect issuer. Traduora keeps issuing its own access tokens; the issuer only proves who signs in.
Off by default. Unless TR_AUTH_EVERID_ENABLED=true: the provider is not listed by GET /api/v1/auth/providers, no button shows, every Ever ID path answers 400 and nothing is requested from the issuer. Password, API client and Google sign-in work exactly as before (the existing e2e suite runs unchanged, and a new test asserts the Google token request body byte for byte).
API
providers.everidfromTR_AUTH_EVERID_*(seedocs/configuration.md). Scopes:openid profile email, plus the organization and Ever Platform audience scopes whenTR_AUTH_EVERID_PLATFORM_PROJECT_IDis set. When enabled, one OpenID Connect discovery at boot; incomplete settings, a non-https issuer or a failed discovery leave it off with one warning line, never a crash. An issuer on an Ever host is used only by the Ever-operated cloud (TR_EVER_INSTALL_SOURCE=cloud), decided from the configured URL before any request.OidcProviderService(jose): code exchange with the PKCE verifier (HTTP Basic client authentication,client_secret_postonly when the issuer supports nothing else); ID token verification: signature,issamong the accepted issuers (1 to 3, kept exactly as configured),aud/azp,exp,iat,nonce,email_verified === true. Key set cached 600 s, unknownkidrefetched at most once per 30 s, stale keys served up to 6 h while the issuer is unreachable (without retrying it for 30 s after a failure). Discovery documents must name the configured issuer and keep their endpoints on its origin.- Accounts are found by
(issuer, subject)only, in the newuser_identitytable:- connected identity: signed in (no pending invitation is accepted on this path);
- an account has the same email:
409 account_exists, nothing linked, no token; - new person:
409 signup_confirmation_requiredwith a sealed record (AES-256-GCM, key derived fromTR_SECRET, 10 min) and the pending invitations; the account is created only byPOST /api/v1/auth/everid/signup-confirm, which accepts only the ticked invitations.TR_SIGNUPS_ENABLED=falsestill means invitation only (403 signup_disabled).
- Connect from settings:
POST /api/v1/auth/identities/connect(needs a sign-in at the issuer within 300 s plus 60 s skew, else400 reauth_required) answers both emails,POST /api/v1/auth/identities/connect/confirmlinks (403for another account,409 subject_linkedwhen the identity is linked elsewhere).GET /api/v1/auth/identities,DELETE /api/v1/auth/identities/:id(409 last_sign_in_methodwhen the account has no password and no other identity). Identity changes lock the account's row. - Back-channel logout:
POST /api/v1/auth/everid/backchannel-logout(form-encodedlogout_token). Access tokens of an Ever ID sign-in carrysid(the issuer's session, as an issuer-scoped key) andjti; once the issuer ends that session they answer 401, also when the logout arrives before the session's first sign-in here. Logout tokens older than 300 s, without the logout event, or replayed (ever_id_logout_jti) are refused. Tokens withoutsid(password, API client, Google) never reach the check.TR_AUTH_EVERID_BACKCHANNEL_LOGOUT_ENABLED=falseturns the route off. - One migration (
1794009600000-ever-id) createsuser_identity,ever_id_session,ever_id_logout_jtion PostgreSQL, MySQL and SQLite (IF NOT EXISTS, camelCase columns on MySQL);down()drops only these three tables. No existing table changes. - New error answers keep their status and a stable code (
{ error: { code, message, details? } },Cache-Control: no-store) through one additive branch of the exception filter. The auth rate limit (TR_AUTH_THROTTLE_*) applies to the new routes (except back-channel logout, which the issuer sends from its own servers) and to Ever ID requests onsignup-provider; Google requests on that route are not rate limited, as before. - No Ever ID token is stored or logged; the client secret never leaves the API.
Webapp
everidauthorization request withstate,nonceand PKCE S256, kept in session storage and read once by the callback;prompt=login&max_age=300for a connect. Nologin_hint, no Google-specific parameters. The Google request string is unchanged.- The callback reads
state(absent: Google, as before). - "Continue with Ever ID" text button on the sign-in and sign-up pages.
/auth/everid/confirm: "Create your Traduora account", name and email read-only, each pending invitation with its own unchecked checkbox.- Account Settings: "Connected sign-in methods" (shown only while Ever ID is on): connect with both emails shown before confirming, disconnect.
karma-jasmineadded to the webapp dev dependencies:src/karma.conf.jsalready required it, song testcould not start. AChromeHeadlessCIlauncher is added for CI.
Tests
- API unit:
oidc-provider.service.spec.ts(activation and the Ever-host rule, code exchange, ID token rejections, key set cache, cooldown and retry delay, logout tokens, documented claim examples with optional hints),ever-id-session.service.spec.ts(real migrations on in-memory SQLite: links, unlink rule, sealed records, issuer-scoped sessions, logout before first sign-in, logout replay, sweep),ever-id-static.spec.ts(no unverified decode on the Ever ID path, no redirect, nologin_hint, no token in logs). - API e2e
test/ever-id.e2e-spec.tsagainst a mock OpenID Connect issuer intest/mock-oidc/: off (zero requests,nock.disableNetConnect), Ever issuer without the cloud install source, discovery failure, listing, sign-up confirmation, equal email, invitations with signups disabled, connected sign-in, PKCE/nonce/unverified email rejections, connect, identities, back-channel logout, migration down and up, Google request body. - Webapp unit: authorization request (Ever ID and Google), callback, sign-in button, confirmation screen, settings card, NGXS state.
- New
ciworkflow: API lint and unit tests, the e2e suite on SQLite, PostgreSQL and MySQL, webapp unit tests.
Local runs (Windows, Node 24):
| Suite | SQLite | PostgreSQL 18 | MySQL |
|---|---|---|---|
API e2e, whole suite (18 files, auth.e2e-spec.ts unchanged) | 166 / 166 | 166 / 166 | not run locally (no MySQL available) |
API e2e, ever-id.e2e-spec.ts | 15 / 15 | 15 / 15 | |
| API unit, new specs (OIDC provider, session service, static checks) | 48 / 48 | n/a | n/a |
Webapp unit (ng test, headless Chrome) | 26 / 26 |
The new ci workflow (Linux, Node 26.12.1) on 610b519: API e2e 166 / 166 on SQLite, PostgreSQL 15 and MySQL 5.7; API lint and unit 95 / 95; webapp unit 26 / 26. CircleCI test green.
Also: tslint (API) clean, prettier --check clean on every changed file, tsc and ng build pass, yarn install --frozen-lockfile passes. The full API unit run is 88 / 89 on Windows: properties.spec.ts (untouched formatter) compares against os.EOL, so it fails on Windows only.
Configuration
See the new rows and the "Sign in with Ever ID (optional)" section of docs/configuration.md; docker-compose.yaml gains commented TR_AUTH_EVERID_* lines only (defaults unchanged).
🤖 Generated with Claude Code