Skip to content

feat: accept oidc prompt params and add auth_time/sid id_token claims - #3195

Merged
tada5hi merged 1 commit into
masterfrom
feat/authorize-prompt-surface
Jul 7, 2026
Merged

tada5hi merged 1 commit into
masterfrom
feat/authorize-prompt-surface

Conversation

@tada5hi

@tada5hi tada5hi commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #3194 (realm binding). PR B of the plan in .agents/plans/041-authorize-session-binding.md.

Problem

authup silently stripped the OIDC prompt / max_age / login_hint authorize params, so a relying party had no standard way to force account selection or re-authentication. Combined with a lingering authup session, /authorize would silently continue as the current user — the "no confirmation to continue as X or choose another account" half of the reported issue. Two pre-existing bugs also rode along: the id_token auth_time claim was the token issuance time (not the real authentication time), and discovery advertised revocation_endpoint as /token (an RFC 7009 POST there never worked).

What this does

Because authup's /authorize is a hosted login page, the hosted UI renders the prompt behavior for every RP — kit or non-kit React/other:

  • prompt=select_account → an "Continue as X / Use another account" chooser instead of silently continuing. buildAuthorizeURL (kit) defaults to select_account, so kit apps inherit account-switching on a version bump (opt out by passing prompt='').
  • login_hint → pre-fills the identifier field (canonicalized trim().toLowerCase()).
  • prompt=consent → forces the consent screen even for a built_in client.
  • prompt=login / max_age → freshness enforced server-side in OAuth2Authorization.authorize() against the backing session's created_at (never refreshed_at — a token refresh must not reset the authentication instant); a session-less HTTP Basic authorize counts as freshly authenticated. The window is config.oauth2PromptLoginMaxAge (OAUTH2_PROMPT_LOGIN_MAX_AGE, default 60s — a documented stateless approximation). Unknown prompt tokens are ignored (forward-compat); none combined with any other value is invalid_request.

Bug fixes included

  • id_token auth_time is now the session's creation instant (was the issuance time == iat).
  • sid claim (= session_id) added to the id_token — prerequisite for RP-initiated / back-channel logout (PR C).
  • Discovery advertises prompt_values_supported and fixes revocation_endpoint → /token/revoke.

Testing

Full apps/server-core suite (1126) + @authup/i18n parity (77) + @authup/client-web-kit (11) green. New tests: validator (unknown-prompt ignored, none+others → invalid_request, max_age coercion, login_hint canonicalization), deterministic prompt=login/max_age enforcement via a fake session manager with controlled created_at (stale → login_required, fresh → passes, session-less → passes), the id_token sid/auth_time e2e, and discovery assertions.

Notes / deferred

Summary by CodeRabbit

  • New Features
    • Added support for account selection during sign-in, including a new prompt to continue with the current account or switch to another one.
    • Login screens can now prefill the username from a hint in the authorization request.
    • OpenID metadata now advertises supported prompt options and the correct token revocation endpoint.
  • Bug Fixes
    • Improved re-authentication handling for prompt=login and max_age requests.
    • ID tokens now include session and authentication timing details when available.

Copilot AI review requested due to automatic review settings July 7, 2026 16:51
@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@tada5hi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 68525886-0572-43a6-9819-04e171a0f2e8

📥 Commits

Reviewing files that changed from the base of the PR and between c2fa21c and 675eecf.

📒 Files selected for processing (41)
  • .agents/architecture.md
  • apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/realm/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/types.ts
  • apps/server-core/src/app/modules/config/constants.ts
  • apps/server-core/src/app/modules/config/normalize.ts
  • apps/server-core/src/app/modules/config/read/env.ts
  • apps/server-core/src/app/modules/config/types.ts
  • apps/server-core/src/app/modules/config/validator.ts
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • apps/server-core/src/core/oauth2/authorization/code-request/validator.ts
  • apps/server-core/src/core/oauth2/authorization/module.ts
  • apps/server-core/src/core/oauth2/authorization/types.ts
  • apps/server-core/src/core/oauth2/token/issuer/open-id/module.ts
  • apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts
  • apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts
  • apps/server-core/test/unit/http/controllers/entities/realm-openid.spec.ts
  • apps/server-core/test/unit/http/controllers/workflows/token/grant-authorize.spec.ts
  • docs/src/guide/deployment/configuration-server-core.md
  • docs/src/guide/development/api-oauth2.md
  • packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue
  • packages/client-web-kit/src/components/workflows/authorize/Authorize.vue
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue
  • packages/client-web-kit/src/components/workflows/login/LoginForm.vue
  • packages/client-web-kit/src/core/oauth2/authorization-request.ts
  • packages/core-kit/src/domains/authorization-code/entity.ts
  • packages/errors/src/constants.ts
  • packages/i18n/src/catalogs/de/client.ts
  • packages/i18n/src/catalogs/de/error.ts
  • packages/i18n/src/catalogs/en/client.ts
  • packages/i18n/src/catalogs/en/error.ts
  • packages/i18n/src/catalogs/es/client.ts
  • packages/i18n/src/catalogs/es/error.ts
  • packages/i18n/src/catalogs/fr/client.ts
  • packages/i18n/src/catalogs/fr/error.ts
  • packages/i18n/src/constants.ts
  • packages/specs/src/oauth2/constants.ts
  • packages/specs/src/oauth2/error/login-required.ts
  • packages/specs/src/oauth2/types.ts
  • packages/specs/src/openid/type.ts
📝 Walkthrough

Walkthrough

This PR implements OIDC prompt (none/login/consent/select_account), max_age, and login_hint support across the authorization stack: new specs enums/error codes, request validation, server-side reauthentication freshness enforcement using session created_at, auth_time/sid id_token claims, a new account-selection UI component, and translations.

Changes

OIDC Prompt, max_age, login_hint, and Session Claims

Layer / File(s) Summary
Specs contracts
packages/specs/src/oauth2/constants.ts, packages/specs/src/oauth2/error/login-required.ts, packages/specs/src/oauth2/types.ts, packages/core-kit/src/domains/authorization-code/entity.ts, packages/specs/src/openid/type.ts, packages/errors/src/constants.ts
Adds OAuth2AuthorizationPrompt enum, new interaction_required/account_selection_required/consent_required error codes, reauthenticationRequired() error factory, sid/auth_time token payload fields, auth_time/prompt/max_age/login_hint on the authorization-code entity, and prompt_values_supported provider metadata.
Server config
apps/server-core/src/app/modules/config/*
Adds OAUTH2_PROMPT_LOGIN_MAX_AGE env var, oauth2PromptLoginMaxAge config field (default 60), and its validator.
Request validation
apps/server-core/src/core/oauth2/authorization/code-request/validator.ts, apps/server-core/test/unit/.../validator.spec.ts
Validates prompt (rejects none combined with other tokens), max_age, and login_hint, with tests.
Authorization core logic
apps/server-core/src/core/oauth2/authorization/module.ts, .../types.ts, apps/server-core/src/core/oauth2/token/issuer/open-id/module.ts, apps/server-core/test/unit/.../module.spec.ts
Enforces prompt=login/max_age freshness via session created_at, adds auth_time/sid to id_token, and adjusts the id-token issuer, with tests.
HTTP controller wiring
apps/server-core/src/adapters/http/controllers/workflows/authorize/*, apps/server-core/src/adapters/http/controllers/entities/realm/module.ts, apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts, apps/server-core/src/app/modules/http/modules/controller.ts, tests
Wires sessionManager/promptLoginMaxAge into AuthorizeController, adds prompt_values_supported and corrected revocation_endpoint to realm OpenID metadata, and coerces redirect query values to strings; includes unrelated constructor formatting cleanups.
Client UI: select_account, login_hint, consent
packages/client-web-kit/src/components/workflows/authorize/*, packages/client-web-kit/src/components/workflows/login/LoginForm.vue, packages/client-web-kit/src/core/oauth2/authorization-request.ts
Adds AAccountPrompt component and select-account flow in Authorize.vue, passes login_hint into LoginForm, updates auto-consent logic for prompt=consent, and extends buildAuthorizeURL with prompt/max_age/login_hint.
Translations
packages/i18n/src/catalogs/*/client.ts, packages/i18n/src/catalogs/*/error.ts, packages/i18n/src/constants.ts
Adds account-selection UI strings and OAuth error translations across German, English, Spanish, and French catalogs.
Documentation
.agents/architecture.md
Documents the new /authorize OIDC prompt surface and related id_token/discovery metadata changes.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AuthorizeController
  participant OAuth2Authorization
  participant SessionManager
  participant OpenIDTokenIssuer
  Client->>AuthorizeController: /authorize?prompt=login&max_age=...
  AuthorizeController->>OAuth2Authorization: authorize(data, options)
  OAuth2Authorization->>SessionManager: get session by sessionId
  SessionManager-->>OAuth2Authorization: session.created_at
  OAuth2Authorization->>OAuth2Authorization: compute authTime, compare to promptLoginMaxAge/max_age
  OAuth2Authorization->>OpenIDTokenIssuer: issueWithIdentity(auth_time, sid)
  OpenIDTokenIssuer-->>Client: id_token with auth_time/sid claims
Loading
sequenceDiagram
  participant User
  participant AuthorizeVue
  participant AAccountPrompt
  participant Store
  User->>AuthorizeVue: load /authorize with prompt=select_account
  AuthorizeVue->>AuthorizeVue: parse codeRequest.prompt, check accountConfirmed
  AuthorizeVue->>AAccountPrompt: render with identityName
  User->>AAccountPrompt: click Continue or Switch
  AAccountPrompt->>AuthorizeVue: emit continue or switch
  AuthorizeVue->>Store: logout (on switch)
  AuthorizeVue->>AuthorizeVue: set accountConfirmed=true (on continue), proceed to consent
Loading

Possibly related PRs

  • authup/authup#2937: Both PRs modify the identity-provider controller's authorizeIn redirect URL query-string construction logic.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: OIDC prompt support plus new auth_time and sid id_token claims.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/authorize-prompt-surface

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full OpenID Connect prompt/max_age/login_hint support end-to-end (server validation + server-side enforcement + hosted UI behavior), fixes discovery metadata, and corrects/adds id_token session-related claims to better align Authup’s hosted /authorize behavior with OIDC Core expectations.

Changes:

  • Accept and validate OIDC authorize params (prompt, max_age, login_hint) and enforce freshness server-side for prompt=login/max_age.
  • Update hosted kit UI to render prompt=select_account and prompt=consent behavior, and default kit buildAuthorizeURL() to prompt=select_account.
  • Fix OIDC discovery (revocation_endpoint, prompt_values_supported) and adjust id_token claims (auth_time, sid).

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/specs/src/openid/type.ts Adds prompt_values_supported metadata typing.
packages/specs/src/oauth2/types.ts Adds sid and auth_time to token payload type.
packages/specs/src/oauth2/error/login-required.ts Adds re-authentication login-required constructor.
packages/specs/src/oauth2/constants.ts Introduces OAuth2AuthorizationPrompt + new error codes.
packages/i18n/src/constants.ts Adds client translation keys for account chooser.
packages/i18n/src/catalogs/fr/error.ts Adds new OAuth error translations (FR).
packages/i18n/src/catalogs/fr/client.ts Adds account chooser translations (FR).
packages/i18n/src/catalogs/es/error.ts Adds new OAuth error translations (ES).
packages/i18n/src/catalogs/es/client.ts Adds account chooser translations (ES).
packages/i18n/src/catalogs/en/error.ts Adds new OAuth error translations (EN).
packages/i18n/src/catalogs/en/client.ts Adds account chooser translations (EN).
packages/i18n/src/catalogs/de/error.ts Adds new OAuth error translations (DE).
packages/i18n/src/catalogs/de/client.ts Adds account chooser translations (DE).
packages/errors/src/constants.ts Adds new error codes for OAuth interaction/account/consent required.
packages/core-kit/src/domains/authorization-code/entity.ts Extends authorize request + code entity with prompt/login_hint/max_age/auth_time.
packages/client-web-kit/src/core/oauth2/authorization-request.ts Defaults prompt=select_account; adds max_age/login_hint support.
packages/client-web-kit/src/components/workflows/login/LoginForm.vue Adds usernameHint prop and prefill behavior.
packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue Forces consent UI when prompt=consent.
packages/client-web-kit/src/components/workflows/authorize/Authorize.vue Adds select_account chooser flow + passes login_hint.
packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue New account chooser component.
apps/server-core/test/unit/http/controllers/workflows/token/grant-authorize.spec.ts E2E asserts sid + session-based auth_time in id_token.
apps/server-core/test/unit/http/controllers/entities/realm-openid.spec.ts Tests discovery revocation_endpoint + prompt_values_supported.
apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts Tests prompt=login/max_age enforcement with fake session manager.
apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts Tests prompt/max_age/login_hint validation behavior.
apps/server-core/src/core/oauth2/token/issuer/open-id/module.ts Uses threaded auth_time when available.
apps/server-core/src/core/oauth2/authorization/types.ts Wires sessionManager + promptLoginMaxAge into authorization module context.
apps/server-core/src/core/oauth2/authorization/module.ts Enforces freshness + stamps auth_time and sid into id_token.
apps/server-core/src/core/oauth2/authorization/code-request/validator.ts Adds validation/coercion for prompt/max_age/login_hint.
apps/server-core/src/app/modules/http/modules/controller.ts Injects session manager + config prompt max age into authorize controller.
apps/server-core/src/app/modules/config/validator.ts Validates oauth2PromptLoginMaxAge config.
apps/server-core/src/app/modules/config/types.ts Adds oauth2PromptLoginMaxAge config type/docs.
apps/server-core/src/app/modules/config/read/env.ts Reads OAUTH2_PROMPT_LOGIN_MAX_AGE env var.
apps/server-core/src/app/modules/config/normalize.ts Defaults oauth2PromptLoginMaxAge to 60.
apps/server-core/src/app/modules/config/constants.ts Adds env var name constant.
apps/server-core/src/adapters/http/controllers/workflows/authorize/types.ts Adds prompt max age option + session manager in controller ctx types.
apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts Passes prompt max age + session manager into authorization core.
apps/server-core/src/adapters/http/controllers/entities/realm/module.ts Fixes discovery revocation_endpoint and advertises prompt values.
apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts Threads codeRequest params into redirect URL (needs fix for falsy values).
.agents/architecture.md Documents prompt surface, enforcement, and claims behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (6)
packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue (1)

53-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Decorative icon should be hidden from assistive tech.

The VCIcon here is purely decorative (the heading text already conveys the "select account" context), so it should be excluded from the accessibility tree to avoid being announced redundantly by screen readers.

♿ Proposed fix
             <VCIcon
                 name="fa6-solid:user"
                 class="text-6xl text-info-600"
+                aria-hidden="true"
             />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue`
around lines 53 - 56, The VCIcon in AAccountPrompt.vue is decorative and should
not be exposed to assistive technology. Update the VCIcon usage in the authorize
account prompt so it is hidden from the accessibility tree, keeping the heading
as the only announced context. Use the existing VCIcon component there and add
the appropriate accessibility-hidden treatment so screen readers do not announce
it redundantly.
packages/client-web-kit/src/core/oauth2/authorization-request.ts (1)

68-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a narrower type for prompt.

Now that OAuth2AuthorizationPrompt is imported, typing prompt?: string loses the compile-time guarantee that only valid prompt values (or '') are passed.

♻️ Suggested fix
-    prompt?: string,
+    prompt?: OAuth2AuthorizationPrompt | '',
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/client-web-kit/src/core/oauth2/authorization-request.ts` around
lines 68 - 77, The `prompt` field in `OAuth2AuthorizationRequest` is too loosely
typed as `string`, which removes the compile-time validation now that
`OAuth2AuthorizationPrompt` is available. Update the `prompt` property in
`authorization-request.ts` to use the narrower imported prompt type (while still
allowing `''` if needed), and make sure any related references to
`OAuth2AuthorizationRequest` continue to compile with the stricter type.
packages/client-web-kit/src/components/workflows/authorize/Authorize.vue (2)

27-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the shared OAuth2AuthorizationPrompt enum instead of a local string constant.

authorization-request.ts already imports OAuth2AuthorizationPrompt from @authup/specs and uses OAuth2AuthorizationPrompt.SELECT_ACCOUNT. This file re-declares the same value as a raw string (OAUTH2_PROMPT_SELECT_ACCOUNT = 'select_account'), and AuthorizeForm.vue uses the literal 'consent' for the same purpose. If the spec enum values ever change, these hardcoded strings will silently drift out of sync.

♻️ Suggested fix
-import AAccountPrompt from './AAccountPrompt.vue';
+import { OAuth2AuthorizationPrompt } from '`@authup/specs`';
+import AAccountPrompt from './AAccountPrompt.vue';
 import AuthorizeForm from './AuthorizeForm.vue';
 import AuthorizeRealmMismatch from './AuthorizeRealmMismatch.vue';
 import AuthorizeText from './AuthorizeText.vue';
-
-const OAUTH2_PROMPT_SELECT_ACCOUNT = 'select_account';

Then reference OAuth2AuthorizationPrompt.SELECT_ACCOUNT at the prompts.includes(...) call site.

Also applies to: 44-44, 165-177

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/client-web-kit/src/components/workflows/authorize/Authorize.vue`
around lines 27 - 33, Replace the local OAuth prompt string usage with the
shared OAuth2AuthorizationPrompt enum from `@authup/specs` so the values stay in
sync with the spec. In Authorize.vue, remove the OAUTH2_PROMPT_SELECT_ACCOUNT
constant and use OAuth2AuthorizationPrompt.SELECT_ACCOUNT at the
prompts.includes call site; also update AuthorizeForm.vue to use the matching
enum value instead of the hardcoded 'consent' string.

138-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate prompt-parsing logic across components.

The props.codeRequest.prompt ? props.codeRequest.prompt.split(' ') : [] pattern is duplicated verbatim in AuthorizeForm.vue (autoConsent computed). Consider extracting a small shared helper (e.g. parsePromptValues(prompt?: string): string[]) in a common module to avoid future divergence between the two call sites.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/client-web-kit/src/components/workflows/authorize/Authorize.vue`
around lines 138 - 141, The prompt parsing logic is duplicated between
Authorize.vue and AuthorizeForm.vue, so extract the shared
`props.codeRequest.prompt ? props.codeRequest.prompt.split(' ') : []` behavior
into a common helper such as `parsePromptValues(prompt?: string): string[]`.
Update the `autoConsent` computed in `AuthorizeForm.vue` and the prompt handling
in `Authorize.vue` to call that helper so both components stay consistent and
future changes only happen in one place.
apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts (1)

92-133: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add a test for "sessionId provided but session not found".

Coverage is solid for stale/fresh sessions and the session-less path, but there's no test exercising options.sessionId pointing at a session that no longer exists in sessionManager (e.g. revoked). That's exactly the gap flagged in module.ts's freshness fallback — a test here would have caught it.

it('should treat a missing/revoked session as stale for prompt=login', async () => {
    // sessionId does not correspond to any seeded session
    await expect(
        authorization.authorize(buildData({ prompt: 'login' }), identity, { sessionId }),
    ).rejects.toThrow(expect.objectContaining({ code: ErrorCode.OAUTH_LOGIN_REQUIRED }));
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts` around
lines 92 - 133, Add a unit test in the authorization module spec to cover the
case where options.sessionId is provided but sessionManager has no matching
session (revoked/missing). Extend the existing freshness tests around
authorization.authorize and buildData to assert that a prompt=login request with
that sessionId rejects with ErrorCode.OAUTH_LOGIN_REQUIRED, using the same
authorization, identity, and sessionId setup already present.
apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts (1)

46-49: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a regression test for max_age=''.

Given the coercion pitfall flagged in validator.ts (empty string silently becomes 0), add a test asserting the expected behavior once fixed (e.g. max_age: '' → undefined/null, not 0).

it('should not coerce an empty max_age to 0', async () => {
    const output = await validator.run({ ...base, max_age: '' });
    expect(output.max_age).not.toEqual(0);
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts`
around lines 46 - 49, Add a regression test in validator.spec.ts around
validator.run to cover the empty-string max_age case noted in validator.ts:
extend the existing max_age coercion tests with a case like max_age: '' and
assert the result is not 0 (ideally undefined/null once the fix is applied). Use
the existing `validator` and `base` setup so the test clearly exercises the same
code path as the numeric coercion test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts`:
- Around line 339-345: In the IdentityProvider module’s IdP replay path, the
loop over codeRequestKeys currently uses a truthy check on codeRequestValue,
which drops valid falsy values like max_age=0. Update this logic to preserve all
defined values by checking only for null/undefined before calling
url.searchParams.set, and keep the change localized to the codeRequest handling
in this method.

---

Nitpick comments:
In
`@apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts`:
- Around line 46-49: Add a regression test in validator.spec.ts around
validator.run to cover the empty-string max_age case noted in validator.ts:
extend the existing max_age coercion tests with a case like max_age: '' and
assert the result is not 0 (ideally undefined/null once the fix is applied). Use
the existing `validator` and `base` setup so the test clearly exercises the same
code path as the numeric coercion test.

In `@apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts`:
- Around line 92-133: Add a unit test in the authorization module spec to cover
the case where options.sessionId is provided but sessionManager has no matching
session (revoked/missing). Extend the existing freshness tests around
authorization.authorize and buildData to assert that a prompt=login request with
that sessionId rejects with ErrorCode.OAUTH_LOGIN_REQUIRED, using the same
authorization, identity, and sessionId setup already present.

In
`@packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue`:
- Around line 53-56: The VCIcon in AAccountPrompt.vue is decorative and should
not be exposed to assistive technology. Update the VCIcon usage in the authorize
account prompt so it is hidden from the accessibility tree, keeping the heading
as the only announced context. Use the existing VCIcon component there and add
the appropriate accessibility-hidden treatment so screen readers do not announce
it redundantly.

In `@packages/client-web-kit/src/components/workflows/authorize/Authorize.vue`:
- Around line 27-33: Replace the local OAuth prompt string usage with the shared
OAuth2AuthorizationPrompt enum from `@authup/specs` so the values stay in sync
with the spec. In Authorize.vue, remove the OAUTH2_PROMPT_SELECT_ACCOUNT
constant and use OAuth2AuthorizationPrompt.SELECT_ACCOUNT at the
prompts.includes call site; also update AuthorizeForm.vue to use the matching
enum value instead of the hardcoded 'consent' string.
- Around line 138-141: The prompt parsing logic is duplicated between
Authorize.vue and AuthorizeForm.vue, so extract the shared
`props.codeRequest.prompt ? props.codeRequest.prompt.split(' ') : []` behavior
into a common helper such as `parsePromptValues(prompt?: string): string[]`.
Update the `autoConsent` computed in `AuthorizeForm.vue` and the prompt handling
in `Authorize.vue` to call that helper so both components stay consistent and
future changes only happen in one place.

In `@packages/client-web-kit/src/core/oauth2/authorization-request.ts`:
- Around line 68-77: The `prompt` field in `OAuth2AuthorizationRequest` is too
loosely typed as `string`, which removes the compile-time validation now that
`OAuth2AuthorizationPrompt` is available. Update the `prompt` property in
`authorization-request.ts` to use the narrower imported prompt type (while still
allowing `''` if needed), and make sure any related references to
`OAuth2AuthorizationRequest` continue to compile with the stricter type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff666484-909d-47f2-ac2b-0b9763fe206b

📥 Commits

Reviewing files that changed from the base of the PR and between b7fc25c and c2fa21c.

📒 Files selected for processing (39)
  • .agents/architecture.md
  • apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/realm/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/types.ts
  • apps/server-core/src/app/modules/config/constants.ts
  • apps/server-core/src/app/modules/config/normalize.ts
  • apps/server-core/src/app/modules/config/read/env.ts
  • apps/server-core/src/app/modules/config/types.ts
  • apps/server-core/src/app/modules/config/validator.ts
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • apps/server-core/src/core/oauth2/authorization/code-request/validator.ts
  • apps/server-core/src/core/oauth2/authorization/module.ts
  • apps/server-core/src/core/oauth2/authorization/types.ts
  • apps/server-core/src/core/oauth2/token/issuer/open-id/module.ts
  • apps/server-core/test/unit/core/oauth2/authorization/code-request/validator.spec.ts
  • apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts
  • apps/server-core/test/unit/http/controllers/entities/realm-openid.spec.ts
  • apps/server-core/test/unit/http/controllers/workflows/token/grant-authorize.spec.ts
  • packages/client-web-kit/src/components/workflows/authorize/AAccountPrompt.vue
  • packages/client-web-kit/src/components/workflows/authorize/Authorize.vue
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue
  • packages/client-web-kit/src/components/workflows/login/LoginForm.vue
  • packages/client-web-kit/src/core/oauth2/authorization-request.ts
  • packages/core-kit/src/domains/authorization-code/entity.ts
  • packages/errors/src/constants.ts
  • packages/i18n/src/catalogs/de/client.ts
  • packages/i18n/src/catalogs/de/error.ts
  • packages/i18n/src/catalogs/en/client.ts
  • packages/i18n/src/catalogs/en/error.ts
  • packages/i18n/src/catalogs/es/client.ts
  • packages/i18n/src/catalogs/es/error.ts
  • packages/i18n/src/catalogs/fr/client.ts
  • packages/i18n/src/catalogs/fr/error.ts
  • packages/i18n/src/constants.ts
  • packages/specs/src/oauth2/constants.ts
  • packages/specs/src/oauth2/error/login-required.ts
  • packages/specs/src/oauth2/types.ts
  • packages/specs/src/openid/type.ts

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

authup

npm i https://pkg.pr.new/authup@3195

@authup/client-web

npm i https://pkg.pr.new/@authup/client-web@3195

@authup/server-core

npm i https://pkg.pr.new/@authup/server-core@3195

@authup/access

npm i https://pkg.pr.new/@authup/access@3195

@authup/client-web-kit

npm i https://pkg.pr.new/@authup/client-web-kit@3195

@authup/client-web-kit-theme

npm i https://pkg.pr.new/@authup/client-web-kit-theme@3195

@authup/client-web-nuxt

npm i https://pkg.pr.new/@authup/client-web-nuxt@3195

@authup/client-web-theme

npm i https://pkg.pr.new/@authup/client-web-theme@3195

@authup/core-http-kit

npm i https://pkg.pr.new/@authup/core-http-kit@3195

@authup/core-kit

npm i https://pkg.pr.new/@authup/core-kit@3195

@authup/core-realtime-kit

npm i https://pkg.pr.new/@authup/core-realtime-kit@3195

@authup/errors

npm i https://pkg.pr.new/@authup/errors@3195

@authup/i18n

npm i https://pkg.pr.new/@authup/i18n@3195

@authup/kit

npm i https://pkg.pr.new/@authup/kit@3195

@authup/server-adapter-kit

npm i https://pkg.pr.new/@authup/server-adapter-kit@3195

@authup/server-adapter-node

npm i https://pkg.pr.new/@authup/server-adapter-node@3195

@authup/server-adapter-socket-io

npm i https://pkg.pr.new/@authup/server-adapter-socket-io@3195

@authup/server-adapter-web

npm i https://pkg.pr.new/@authup/server-adapter-web@3195

@authup/server-kit

npm i https://pkg.pr.new/@authup/server-kit@3195

@authup/server-test-kit

npm i https://pkg.pr.new/@authup/server-test-kit@3195

@authup/specs

npm i https://pkg.pr.new/@authup/specs@3195

commit: 9421447

Accept the OIDC Core §3.1.2.1 authorize params prompt / max_age / login_hint
(previously silently stripped). Since /authorize is a hosted login page, the
kit's Authorize.vue renders the behavior for every RP: prompt=select_account
shows a "continue as / use another account" chooser instead of silently
continuing, login_hint pre-fills the identifier, and prompt=consent forces the
consent screen for built_in clients. buildAuthorizeURL defaults
prompt=select_account so kit apps inherit account switching.

prompt=login / max_age freshness is enforced server-side in
OAuth2Authorization.authorize() against the backing session's created_at (never
refreshed_at); the window is config oauth2PromptLoginMaxAge (default 60s). A
session-less (HTTP Basic) authorize counts as freshly authenticated.

id_token claims: auth_time is now the session's creation time threaded through
the token payload (was wrongly the issuance time == iat), and a sid claim
(= session_id) is added for RP-initiated / back-channel logout. Discovery
advertises prompt_values_supported and fixes revocation_endpoint from /token to
/token/revoke (RFC 7009).

Stacked on the realm-binding branch (plan 041 PR B).
@tada5hi
tada5hi force-pushed the feat/authorize-prompt-surface branch from 9421447 to 675eecf Compare July 7, 2026 17:31
@tada5hi
tada5hi merged commit 10da494 into master Jul 7, 2026
7 checks passed
@tada5hi
tada5hi deleted the feat/authorize-prompt-surface branch July 7, 2026 17:33
@github-actions github-actions Bot mentioned this pull request Jul 7, 2026
tada5hi added a commit that referenced this pull request Jul 8, 2026
…-ups) (#3197)

* fix: rp-initiated logout & authorize hardening (plan 041 audit follow-ups)

Post-merge fixes for defects and test gaps surfaced by an audit of plan 041
(#3194/#3195/#3196). Closes plan 042 items #1, #11 and most of #12.

Security / correctness:
- AEndSessionForm gates its on-mount local sign-out on
  `serverRevoked && hintSub === store.user.id` — a cross-site
  /logout?id_token_hint=<attacker's own token> can no longer force-log-out an
  unrelated victim who merely renders the page (forced-logout CSRF). The
  controller forwards `hintSub` (verified hints only) into the payload.
- LogoutController bounces back to the RP only when the logout was actually
  performed (serverRevoked && validated redirect). A hint-less or forged
  request renders the click-gated confirm page and redirects after sign-out,
  instead of 302-ing back while the session survives.
- Authorize.vue: a fresh login no longer re-prompts prompt=select_account
  (LoginForm `done` sets accountConfirmed), and the chooser waits for `user`
  to resolve (no empty-name flash).
- /authorize hydration payload trimmed to a ClientSummary DTO (no redirect_uri
  patterns, grant_types, internal URLs, secret flags).
- prompt=none removed from discovery prompt_values_supported + docs (its
  silent-auth error redirect is unimplemented).
- empty `max_age=` is treated as absent instead of coercing to 0
  (z.coerce.number('') === 0 would force re-authentication).
- AuthorizeForm renders a "Signed in as X - Not you?" switch chip (+ i18n).
- Remove the dead OAuth2AuthorizationCode.auth_time field; use specs enums for
  prompt/error string comparisons instead of literals.

Tests:
- /logout HTTP e2e matrix (revoke, redirect+state, hint-less no-op,
  access-token/forged hint no-revoke, unregistered redirect dropped).
- server-kit ignoreExpiry (expired+valid-sig accepted; bad-sig/nbf rejected).
- auth_time passthrough + auth_time!=refreshed_at pins; redirectUriVerified;
  confidential refresh exemption; cross-realm login_required no-identity-oracle
  body; clickjacking headers + trimmed-DTO; max_age empty-vs-0; kit gate spec.

* fix: use a button for the "Not you?" switch affordance

The account-switch affordance is an action, not navigation — render it as a
<button type="button"> styled like a link instead of an <a href="#"> so it has
correct button semantics and keyboard behavior (Enter/Space activation), and
matches the rest of the form's actions.

* fix: reliably skip the account chooser after a fresh login on /authorize

The prompt=select_account chooser reappeared right after entering
username/password on the hosted /authorize page. The previous fix keyed off
LoginForm's `done` emit, but on login the access-token flip re-renders
Authorize and unmounts LoginForm before `done` fires, so the flag that skips
the chooser was never set — the chooser stayed.

Key off the store's LOGGED_IN dispatcher event instead. It is emitted only by
an explicit login() (the form), never by a session restored from cookies
(resolve() → RESOLVED), so a lingering session still gets the chooser while a
fresh login skips it — independent of component mount/unmount timing.

Adds a component spec pinning all three cases (lingering shows, LOGGED_IN
skips, RESOLVED does not suppress).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants