Cut-down OIDC provider¶
Status: built. Nexus is an OpenID Provider so another app can offer "Sign in with Nexus"
instead of holding its own EVE application. One database per install; the issuer is that
install's PUBLIC_URL. Federation between installs is this provider (see
decision 0001).
What a pilot and an admin do¶
An admin opens Admin → OIDC Clients, registers the app, and copies the client id and (for a confidential app) the secret. The secret is shown once. The pilot hits the app, the app sends them to Nexus, Nexus shows a consent screen the first time and again if the app asks for more, then sends them back with a code. The app exchanges the code for tokens. The pilot can revoke the app later on Connected Services.
Endpoints¶
The issuer is PUBLIC_URL with no trailing slash. It is not taken from the request's
Host header. Client IP for the audit log still follows TRUSTED_PROXIES.
| Discovery | GET /.well-known/openid-configuration (same document at /.well-known/oauth-authorization-server) |
| JWKS | GET /oauth/jwks |
| Authorize | GET /oauth/authorize |
| Token | POST /oauth/token (application/x-www-form-urlencoded) |
| Userinfo | GET or POST /oauth/userinfo, Authorization: Bearer only |
| Revocation | POST /oauth/revoke (RFC 7009) |
| Logout | GET /oauth/end_session, then a confirm POST |
Discovery lists code only, S256 only, and the token auth methods client_secret_basic,
client_secret_post, and none.
Clients¶
Confidential and public. Nexus generates the id (nxc_…) and, for confidential clients,
the secret (nxs_…). The secret is stored as an Argon2id hash. Redirect URIs are an exact
string match against the registered list: no wildcards, no fragments, https only, except
http://localhost and http://127.0.0.1 (any port) for development. At most 10.
Refresh tokens are off unless the admin turns them on and the app requests the
offline_access scope. Kind (public vs confidential) does not change after creation.
Rotating a client secret revokes that client's refresh tokens and access tokens. The
registry has a checkbox to keep current sign-ins instead. A refresh token presented again
within 30 seconds of being rotated may be retried once. That retry mints a new pair in
the same family and does not revoke it. A second presentation of the same token, or any
reuse after 30 seconds, revokes the family. The raw successor is not stored (only its
hash), so the retry cannot replay the exact previous response: the legitimate client and
anyone who captured the rotated token can each hold a live pair until one of them is
rotated again. One retry is the trade-off that keeps a lost response from signing the
pilot out, without leaving the rotated token usable for the whole window. An expired
token is rejected before that path, so grace cannot extend a token past its lifetime.
Asking to refresh with a scope the client no longer holds returns invalid_scope and
leaves the family in place.
prompt=login and max_age send the pilot through EVE sign-in again. The requirement
(that a new login is needed, the max_age, and the earliest acceptable auth_time) is
stored on the authorize transaction and checked again when the pilot approves. A session
from before that request, or one older than max_age, is login_required. max_age=0
means this request itself must include a new EVE login; it is not a zero-second window,
which would also reject the login that just completed. prompt=none never shows a screen:
login_required when a sign-in is needed, consent_required when consent is. There is no
token introspection endpoint; that belongs with the later read API.
Who may sign in¶
Fail closed. A client with no access rule allows only superadmins. Creating a client does not open it to the alliance. Superadmins can complete a test sign-in before any rule exists; that matches how superadmins already bypass permission checks. Once the client has at least one State or group rule, an account may sign in if it is a superadmin or it currently matches a rule.
Inactive and blacklisted accounts are refused even if they are superadmins. Authorize, refresh, and userinfo all re-check. A refresh that fails this check revokes that refresh family, so losing the State, the group, or being blacklisted stops new tokens.
The registry permission is admin.oidc.manage (seeded with the original schema). Superadmins
hold it. Anyone else needs it granted through Access Control.
Consent¶
The first time, and whenever the requested scopes are not already granted, and whenever the
app sends prompt=consent. Allowed scopes are the intersection of what the app registered,
what it asked for, and what the pilot agreed to. The consent POST checks the redirect URI
and the scopes against the client as it is now, and that the client is still enabled.
prompt=none never shows a screen: login_required when a sign-in (or a fresh one) is
needed, consent_required when consent is. prompt=login and max_age send the pilot
through EVE sign-in again.
The consent screen is a normal Nexus page. Framing is refused (frame-ancestors 'none',
and authorize rejects Sec-Fetch-Dest: iframe). The consent POST checks the Origin
against PUBLIC_URL, same as other state-changing forms. Logout is a confirm POST for the
same reason: SameSite=Lax still sends the session cookie on a top-level GET.
If the pilot is not signed in, Nexus remembers the request in an encrypted cookie
(nexus_oidc_resume, 10 minutes) and sends them through the normal EVE sign-in. Afterwards
they land on the consent screen.
Tokens and keys¶
| Token | Lifetime | Storage |
|---|---|---|
| Authorization code | 60 seconds, one use | SHA-256 only. Bound to client, redirect URI, S256 challenge, and nonce. A wrong verifier burns the code. Using a code twice revokes the token family issued from it. |
| Access token | 10 minutes, opaque bearer | SHA-256 only. Revocation takes effect immediately. |
| ID token | 10 minutes, ES256 JWT | Not stored. kid selects the key in JWKS. |
| Refresh token | 30 days, only with offline_access |
SHA-256 only. Rotated on every use. One retry within 30 seconds mints a new pair and does not revoke the family. A second retry, or reuse after 30 seconds, does. |
Signing keys are generated by Nexus (P-256). The private key (PKCS#8 DER) is sealed with
the vault master key, bound to the key id. The public key is in oidc_signing_keys and in
JWKS. Rotate signing key retires the old key: it stops signing, and it stays published
until existing ID tokens expire (10 minutes, plus a minute of clock skew). A new install
creates the first key the first time JWKS or a token is needed.
/oauth/authorize has its own per-IP budget (default 30). /oauth/token and
/oauth/revoke have two: per client id and IP (default 120) and per IP alone (default
60), so rotating client ids cannot force unlimited Argon2 work. At most two Argon2
verifications run at once; a request that cannot get a slot within a moment gets
temporarily_unavailable. /oauth/jwks is capped per IP (default 60). A request with no
client IP shares one bucket. IPv6 addresses share a bucket per /64.
Claims¶
sub is the Nexus account id (a UUID), never a character id. name is the main
character's name and is released only with the profile scope. ID tokens also carry
auth_time (when the pilot last signed in with EVE), at_hash, jti, and azp.
| Scope | Released |
|---|---|
openid |
sub |
profile |
name, preferred_username, main character id, corporation id and name, alliance id and name |
groups |
groups (group slugs) and state (State slug) |
eve |
one eve object with the same character, corporation, and alliance |
offline_access |
no extra claims; asks for a refresh token |
Nothing else is released. The superadmin flag is not a claim.
How another app uses it¶
- Register the app and set the exact redirect URI and scopes.
- Send the pilot's browser to
/oauth/authorizewithresponse_type=code,scope(includeopenid),state,nonce, and PKCE S256. Use the system browser, not an embedded webview. - Exchange the code at
/oauth/tokenwith the same redirect URI and the code verifier. Confidential apps authenticate with HTTP Basic orclient_secret_post. - Validate the ID token against JWKS (
iss=PUBLIC_URL,aud= client id,kidin the set) or call userinfo with the bearer access token. - Map
groupsandstateonto the app's own roles. Checkstateon every sign-in; Nexus also re-checks on refresh. - The pilot revokes the app on Connected Services, which deletes consent and live tokens.
A separate read API for add-ons (characters, groups, and so on, called with this access token) is not part of this provider. See the roadmap.
Deliberately left out¶
Implicit, hybrid, password, and client-credentials grants. Dynamic registration. Request objects, pushed authorization requests, and device-code flow. JWT access tokens (opaque tokens so revocation is immediate). Token introspection is left for the read API. Wildcard redirects. A plugin runtime inside the Nexus process. The read API above.