8000 [OID4VCI]: Add credential refresh idle timeout for refresh tokens by Awambeng · Pull Request #53588 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

[OID4VCI]: Add credential refresh idle timeout for refresh tokens - #53588

Open
Awambeng wants to merge 4 commits into
keycloak:mainfrom
adorsys:issue-52380
Open

Awambeng wants to merge 4 commits into
keycloak:mainfrom
adorsys:issue-52380

Conversation

@Awambeng
@Awambeng Awambeng commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

This PR adds a configurable idle timeout for OID4VCI refresh tokens. This ensures that an unused refresh token expires after a defined period instead of remaining valid for the full credential lifetime.

Key changes:

  • Add a new vc.refresh_idle_timeout_in_seconds client-scope attribute with a 30-day default
  • Limit the refresh token lifetime to the configured idle timeout
  • Restart the idle timeout each time the refresh token is used
  • Validate that the refresh interval is not greater than the idle timeout, and that the idle timeout does not exceed the credential lifetime
  • Validate the merged effective settings on client-scope update, so partial updates cannot bypass these checks
  • Retain the refresh-token rotation record until the latest expiration of any token in the family, so replay protection cannot lapse when the idle timeout is lowered
  • Add the new field, validation, and help text to the Admin Console, and drop empty timeout values instead of submitting them
  • Derive form defaults from the credential lifetime currently in the form rather than the saved value
  • Add backend tests, including a partial-update regression test, and Playwright tests
  • Update the VC issuer documentation

Closes #52380

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Replay-protection retention and configuration handling have unresolved correctness issues.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity

Open (4)
What changed in this PR

Adds configurable idle expiration to Keycloak’s OID4VCI refresh tokens, addressing #52380.

Changes:

  • Adds a 30-day default idle timeout, renewed on refresh and bounded by credential lifetime.
  • Adds configuration validation and Admin Console controls.
  • Extends backend tests, Playwright tests, and documentation.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​oid4vc/​OID4VCRefreshCredentialTest.java Tests idle expiration and renewal.
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​oid4vc/​OID4VCClientScopeTest.java Tests timeout constraints.
services/​src/​main/​java/​org/​keycloak/​protocol/​oid4vc/​refresh/​OID4VCIRefreshTokenProvider.java Applies idle timeout to token expiration.
services/​src/​main/​java/​org/​keycloak/​protocol/​oid4vc/​OID4VCLoginProtocolFactory.java Validates expiration settings.
services/​src/​main/​java/​org/​keycloak/​protocol/​oid4vc/​model/​CredentialScopeRepresentation.java Exposes idle-timeout accessors.
server-spi-private/​src/​main/​java/​org/​keycloak/​models/​oid4vci/​CredentialScopeModel.java Defines the attribute and derived default.
js/​apps/​admin-ui/​test/​client-scope/​oid4vci-client-scope.spec.ts Tests timeout controls and validation.
js/​apps/​admin-ui/​src/​components/​time-selector/​TimeSelectorControl.tsx Displays field-level validation errors.
js/​apps/​admin-ui/​src/​client-scopes/​details/​ScopeForm.tsx Adds timeout input and dependent validation.
js/​apps/​admin-ui/​maven-resources/​theme/​keycloak.v2/​admin/​messages/​messages_en.properties Adds labels, help, and validation messages.
docs/​documentation/​server_admin/​topics/​oid4vci/​vc-issuer-configuration.adoc Documents idle expiration and refresh behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Partial client-scope updates can bypass timeout validation and persist incompatible expiration settings.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (4)

Copilot AI balanced review requested due to automatic review settings October 6, 2026 15:44
@Awambeng
Awambeng requested review from a team as code owners October 6, 2026 15:44
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Post-validation defaults can persist invalid scope settings, cleared-field validation remains inconsistent, and the CRL test lacks required server setup.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings October 6, 2026 15:53
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Security-sensitive rotation-record retention needs human review because timeout reductions and carried-forward expiration lack regression coverage.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)

Copilot AI balanced review requested due to automatic review settings October 8, 2026 08:05
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Awambeng
Awambeng requested a balanced review from Copilot October 8, 2026 08:08
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the OID4VCI refresh-token idle-expiration changes.

No open issues 🎉

Review effort: Balanced

@eudi-dev-bot eudi-dev-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.

AI review by Claude Code: Fix first · 1 should fix, 1 follow-up

The PR caps each OID4VCI refresh token at the smaller of the credential expiry and a configurable idle timeout, which restarts on every refresh. It validates the chain of refresh interval, idle timeout and credential lifetime against the merged state on update, and it keeps the rotation record until the latest expiry in the token family. The code matches the description and the earlier review points are fixed. One gap should be closed here: the derived default and the validation allow an idle timeout equal to the refresh interval, and then the refresh token expires just before the credential it should renew.

For EUDI:

EUDI issuers get a bounded refresh token by default, so a wallet that is lost or stops refreshing loses refresh rights after 30 days instead of after the full credential lifetime. Issuers with a refresh interval of 30 days or more should set an explicit idle timeout above the interval until the default leaves slack.

Claude Code wrote this review of 001b758. It read the code without building or running it.

Awambeng asked the tracker's bot account to post this.

Automatic review by Claude Opus 5.5, checked by Claude Fable 5.2: https://oid4vc-sig.eudi-test.dev/reviews/53588.html

- Add a new  client-scope attribute with a 30-day default
- Limit the refresh token lifetime to the configured idle timeout
- Restart the idle timeout when the token is refreshed
- Validate that the idle timeout is between the refresh interval and credential lifetime
- Add the new field and validation to the Admin Console
- Add backend, Playwright tests and update issuer documentation

Closes keycloak#52380

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 16:01
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The persisted client-scope regression lacks @DatabaseTest, so supported-database jobs will not run it.

1 open issue

Review effort: Balanced

* the protocol defaults, and it must be validated against the merged settings, so raising the refresh interval
* above the stored idle timeout is rejected just like a full update.
*/
@Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OID4VCI] Support for "Idle timeout" for OID4VCI refresh tokens

3 participants

0