Skip to content

[OID4VCI]: Fix getAttestationRequirements() for non-JWT proof types#50724

Open
Awambeng wants to merge 2 commits into
keycloak:mainfrom
adorsys:issue-50521
Open

[OID4VCI]: Fix getAttestationRequirements() for non-JWT proof types#50724
Awambeng wants to merge 2 commits into
keycloak:mainfrom
adorsys:issue-50521

Conversation

@Awambeng

@Awambeng Awambeng commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR fixes getAttestationRequirements() to use the configured proof type instead of always reading the jwt configuration.

Key changes

  • Pass proofTypeKey through validateAttestationPayload() to getAttestationRequirements()
  • Replace the hardcoded ProofType.JWT lookup with proofTypeKey
  • Remove the unused ProofType.JWT import
  • Add unit tests covering both jwt and attestation proof types and missing configuration cases

Closes #50521

Copilot AI review requested due to automatic review settings July 9, 2026 10:02
@Awambeng
Awambeng requested a review from a team as a code owner July 9, 2026 10:02

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 attestation validation so key_attestations_required is read from the actual proof-type entry being validated (e.g., attestation) rather than always reading the jwt entry, aligning behavior with configured metadata and closing #50521.

Changes:

  • Thread the proof-type key through validateAttestationPayload(...) into getAttestationRequirements(...).
  • Replace the hardcoded ProofType.JWT lookup with .get(proofTypeKey), and remove the unused static import.
  • Add unit tests verifying correct lookup for both jwt and attestation, plus missing/unsupported configuration cases.

Reviewed changes

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

File Description
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/keybinding/AttestationValidatorUtil.java Fixes attestation requirements lookup to use the provided proof-type key instead of hardcoding jwt.
services/src/test/java/org/keycloak/protocol/oid4vc/issuance/keybinding/AttestationValidatorUtilTest.java Adds coverage proving requirements are read from the correct proof-type entry and handles missing config gracefully.

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

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

Copilot AI review requested due to automatic review settings July 21, 2026 08:06

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

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

@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.forms.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess

Keycloak CI - Base IT (5)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.forms.MultipleTabsLoginTest#multipleTabsParallelLoginTestWithAuthSessionExpiredAndRefreshInTab1

Keycloak CI - Forms IT (chrome)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.webauthn.AppInitiatedActionWebAuthnSkipIfExistsTest#processSetupTwice

Keycloak CI - WebAuthn IT

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:160)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:344)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:48)
...

Report flaky test

@mposolda mposolda self-assigned this Jul 27, 2026

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

@Awambeng Thanks for this PR! It looks good to me, but could you please rebase? There is conflict with your other PR merged ( #50517 )

Awambeng added 2 commits July 27, 2026 10:16
- Thread proofTypeKey through validateAttestationPayload() to getAttestationRequirements()
- Replace the hardcoded .get(JWT) lookup with .get(proofTypeKey)
- Remove the unused ProofType.JWT import
- Add unit tests verifying attestation requirements are read for the correct proof type

Closes keycloak#50521

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Copilot AI review requested due to automatic review settings July 27, 2026 09:16

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

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

@Awambeng

Copy link
Copy Markdown
Contributor Author

@Awambeng Thanks for this PR! It looks good to me, but could you please rebase? There is conflict with your other PR merged ( #50517 )

Thank you, @mposolda! I've rebased and resolved the conflicts. It should be ready to merge once the CI checks are done.

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

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

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: getAttestationRequirements() hardcodes proof-type key to jwt ignoring other types

3 participants