Add Google sign-in for @nextgenerationofunity.org admin accounts

The login page offers "Sign in with Google" above email and password,
once GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET are set on the service.
It's the server-side authorization-code flow with PKCE; the ID token
comes straight from Google's token endpoint and is checked for
issuer, audience, expiry, a verified email and the Workspace domain
(Google's hd claim).

Only accounts admin-cli has made get in. The first Google sign-in
links the account with the same email; later ones match by the link.
A disabled account, one linked to another Google account, or a
missing account is refused, with a message on the login page, and a
refused sign-in never changes the account. admin-cli list shows which
accounts are linked. Setup is in docs/google-sign-in.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 21:27:12 -05:00
parent 64cb2ec56a
commit d4b39251d9
8 changed files with 392 additions and 28 deletions

View file

@ -76,6 +76,9 @@ app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
app.route("/api/feedback", feedback);
app.use("/api/auth/login", rateLimit({ windowMs: 15 * 60_000, max: 10 }));
// Looser than a password guess: each Google sign-in is two requests,
// and Google has already checked the person by the second.
app.use("/api/auth/google/*", rateLimit({ windowMs: 15 * 60_000, max: 40 }));
app.route("/api/admin/panel", panel);
app.route("/api/auth", auth);
app.route("/api/admin", admin);