Skip to content

[OID4VCI] Implement Key-Binding for jwt-credentials and fix it for SD-JWT#49895

Merged
mposolda merged 6 commits into
keycloak:mainfrom
wistefan:46273-49891-implement-key-binding
Jul 24, 2026
Merged

[OID4VCI] Implement Key-Binding for jwt-credentials and fix it for SD-JWT#49895
mposolda merged 6 commits into
keycloak:mainfrom
wistefan:46273-49891-implement-key-binding

Conversation

@wistefan

@wistefan wistefan commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

closes #49891

This PR:

@wistefan
wistefan requested a review from a team as a code owner June 11, 2026 08:48
@wistefan
wistefan force-pushed the 46273-49891-implement-key-binding branch from 9253dd1 to 59074e4 Compare June 11, 2026 08:51
@VinodAnandan

Copy link
Copy Markdown
Contributor

Thanks @wistefan, for the PR. It looks like the DCO checks are currently failing. Could you please take a look when you have a chance?

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

Hi @wistefan,

Thanks for the PR. I have left a few minor comments, could you please take a look when you get a chance?

I also noticed that the commits are unverified and some CI checks are failing. Could you please check those as well?

Thanks!

return this;
}

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.

Could you please remove the extra whitespace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in cb1b59a

this.issuerSignedJWT = issuerSignedJWT;
}

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.

Same here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in cb1b59a

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

LGTM!

@VinodAnandan

Copy link
Copy Markdown
Contributor

@mposolda Could you please help us with the review of this PR ?

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

LGTM

@wistefan
wistefan marked this pull request as draft June 29, 2026 08:01
@wistefan
wistefan marked this pull request as ready for review June 29, 2026 08:02
Copilot AI review requested due to automatic review settings June 29, 2026 08: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

Implements holder key-binding for JWT credentials in OID4VCI issuance and fixes SD-JWT key-binding so the cnf claim is retained when default decoys are generated.

Changes:

  • Implement key-binding for JWT credentials by adding a cnf.jwk claim at signing time.
  • Fix SD-JWT key-binding by treating cnf as a visible SD-JWT claim rather than mutating the issuer payload directly.
  • Extend/adjust tests to validate presence of cnf across SD-JWT decoy configurations and for JWT credentials.

Reviewed changes

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

Show a summary per file
File Description
tests/base/src/test/java/org/keycloak/tests/oid4vc/issuance/signing/LDCredentialSignerTest.java Updates test construction for JwtCredentialBody after API change.
tests/base/src/test/java/org/keycloak/tests/oid4vc/issuance/credentialbuilder/SdJwtCredentialBuilderTest.java Adds parameterized coverage ensuring cnf survives with 0/default and explicit decoys.
tests/base/src/test/java/org/keycloak/tests/oid4vc/issuance/credentialbuilder/JwtCredentialBuilderTest.java Adds test ensuring cnf.jwk is embedded into JWT credentials when key-binding is applied.
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/credentialbuilder/SdJwtCredentialBody.java Changes key-binding injection to add cnf as a visible SD-JWT claim.
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/credentialbuilder/JwtCredentialBuilder.java Adjusts builder to pass JsonWebToken into JwtCredentialBody so late mutations are signed.
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/credentialbuilder/JwtCredentialBody.java Implements JWT key-binding by writing cnf.jwk into the token’s other claims and signing the updated token.
core/src/main/java/org/keycloak/sdjwt/SdJwt.java Refactors default-decoy handling so disclosure payload regeneration happens consistently.

Copilot AI review requested due to automatic review settings June 29, 2026 08:11

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 7 out of 7 changed files in this pull request and generated no new comments.

wistefan and others added 6 commits June 30, 2026 11:48
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
…redentialbuilder/SdJwtCredentialBody.java

Co-authored-by: Awambeng <114798938+Awambeng@users.noreply.github.com>
Signed-off-by: Stefan Wiedemann <stefan.wiedemann@seamware.com>
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Stefan Wiedemann <stefan.wiedemann@seamware.com>
@wistefan
wistefan force-pushed the 46273-49891-implement-key-binding branch from 82f037c to 770253f Compare June 30, 2026 09:49
@mposolda mposolda self-assigned this Jul 24, 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.

@wistefan @Awambeng @VinodAnandan @jordandunmire97-ai Thanks for this PR and for the reviews!

@mposolda
mposolda merged commit db820b2 into keycloak:main Jul 24, 2026
89 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] CNF is not included in sd-jwt when number_of_decoys is not explicitly configured

7 participants