Skip to content

Report OID4VCI credential request errors - #51697

Merged
mposolda merged 1 commit into
keycloak:mainfrom
CAOShurong:codex/51692-oid4vci-error-events
Aug 13, 2026
Merged

Report OID4VCI credential request errors#51697
mposolda merged 1 commit into
keycloak:mainfrom
CAOShurong:codex/51692-oid4vci-error-events

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Closes #51692.

What changed

  • Treat missing OID4VCI credential claims metadata as an empty claim set. This lets a client scope with no protocol mappers issue a credential instead of failing with a null-pointer exception.
  • Record proof-validation failures on the VERIFIABLE_CREDENTIAL_REQUEST_ERROR event, including the OID4VCI error type and the failure reason.
  • Extend the existing endpoint tests to cover a mapper-free optional scope and the event generated for a future-iat proof.

Verification

  • On the unmodified issue base, the mapper-free scenario returned HTTP 500 and the proof-error scenario produced no event.
  • The two focused tests pass with this change.
  • The complete OID4VCJWTIssuerEndpointTest class passes: 55 tests, 0 failures, 0 errors.
  • The affected services and tests/base Spotless checks pass.
  • A reactor package build completed successfully across 82 modules.

AI assistance disclosure

I used an AI coding assistant to help investigate the issue, implement the change, and run the verification. I reviewed the resulting diff and test evidence before submitting it.

Treat absent credential claims metadata as an empty claim set so client scopes
without protocol mappers can issue credentials. Record proof validation
failures on the credential request error event, including the OID4VCI error
type and reason.

Closes keycloak#51692

Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
@CAOShurong
CAOShurong marked this pull request as ready for review August 13, 2026 05:42
@CAOShurong
CAOShurong requested a review from a team as a code owner August 13, 2026 05:42
Copilot AI balanced review requested due to automatic review settings August 13, 2026 05:42

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.

Pull request overview

Fixes OID4VCI credential issuance and error-event reporting.

Changes:

  • Handles missing credential claims metadata as an empty claim set.
  • Records proof-validation errors with their type and reason.
  • Adds regression tests for mapper-free scopes and future-iat proofs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
services/.../OID4VCIssuerEndpoint.java Handles absent claims and reports proof errors.
tests/.../OID4VCJWTIssuerEndpointTest.java Adds regression and event assertions.

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

@mposolda mposolda 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.

@CAOShurong Thanks, I hope to merge if automated tests are OK

@mposolda mposolda self-assigned this Aug 13, 2026

@keycloak-github-bot keycloak-github-bot 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.

Unreported flaky test detected, please review

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.federation.ldap.LDAPUserLoginTest#loginLDAPUserAuthenticationNoneEncryptionSSL

Keycloak CI - Java Distribution IT (windows-latest - temurin - 21)

java.lang.IllegalStateException: User search expected one result. Found 0 users.
	at org.keycloak.testsuite.AbstractTestRealmKeycloakTest.findUser(AbstractTestRealmKeycloakTest.java:57)
	at org.keycloak.testsuite.federation.ldap.LDAPUserLoginTest.verifyLoginSucceededAndLogout(LDAPUserLoginTest.java:148)
	at org.keycloak.testsuite.federation.ldap.LDAPUserLoginTest.runLDAPLoginTest(LDAPUserLoginTest.java:190)
	at org.keycloak.testsuite.federation.ldap.LDAPUserLoginTest.loginLDAPUserAuthenticationNoneEncryptionSSL(LDAPUserLoginTest.java:292)
...

Report flaky test

@mposolda
mposolda merged commit e5c5fe1 into keycloak:main Aug 13, 2026
94 checks passed
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] Some error events not reported

3 participants