boxlang-express-auth 0.2.0
Released .
- Google sign-in (
models/providers/Google.bx,boxExpressAuthGoogle()), built as a preset of a new generic OpenID Connect provider (models/providers/OIDCProvider.bx,boxExpressAuthOIDC()) rather than a Google-only class: Google needs nearly everything OIDC does (discovery, a nonce, ID-token validation), and the tracker's self-hosted Keycloak and Authelia need exactly the same code.- The ID token's signature is checked against the issuer's JWKS even though it arrives straight from the token endpoint, where OIDC Core and Google's docs both allow skipping it. It's cheap, and it means a misrouted or intercepted token endpoint can't mint a login.
iss,aud/azp,exp/iatand thenonceare all checked;noneand HMAC algorithms and RSA keys under 2048 bits are refused. The discovery document must name the configured issuer, or it could point validation at someone else's keys. Plain http is allowed only for loopback issuers, for local Keycloak/Authelia.- The JWKS is cached and refetched once for an unknown
kid(how a key rotation shows up), throttled byjwksMinRefreshSeconds. - Userinfo is read only when the ID token has no email (Authelia's
default), must describe the same
sub, and can't override signed claims. - Google's
hostedDomainis enforced against the signedhdclaim, not just sent as thehdparameter: Google documents the parameter as a UI hint a user can strip. - Only RS256/RS384/RS512 ID tokens for now (
models/Jwt.bx), which covers Google, Keycloak and Authelia defaults.
- Pending logins and identities are keyed by the name a provider is
registered under (
models/Auth.bx), not the provider's ownname. Two generic OIDC providers share a class; keyed byname, they'd have overwritten each other's pending state. GET /auth/:providerbuilds the authorize URL before storing anything, and a failure there is aprovider_errorredirect instead of a 500 — an OIDC provider may fetch its discovery document at that point, and an IdP outage shouldn't look like a crash.authorizeParamson every provider passes extra authorize-URL parameters (prompt,login_hint, …). The parameters the flow's security rests on (state,nonce, PKCE,redirect_uri,scope) are refused, so configuration can't quietly weaken it.exchangeCode()also returnsidTokenwhen the provider sends one, soverify()can keep it (for RP-initiated logout) — it's still never stored by this module.