8000 Introduce mechanism for different trust material sources by dominikschlosser · Pull Request #48869 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Introduce mechanism for different trust material sources - #48869

Merged
mposolda merged 2 commits into
keycloak:mainfrom
dominikschlosser:trust-source-idp
May 25, 2026
Merged

mposolda merged 2 commits into
keycloak:mainfrom
dominikschlosser:trust-source-idp

Conversation

@dominikschlosser
@dominikschlosser dominikschlosser commented May 11, 2026 •
Copy link
Copy Markdown
Contributor

closes #48269

This PR illustrates a possible approach for #48269

@mposolda @Captain-P-Goldfish @VinodAnandan @tdiesler @dteleguin @thomasdarimont WDYT?

@dominikschlosser
dominikschlosser requested a review from a team as a code owner May 11, 2026 08:32
@dominikschlosser
dominikschlosser force-pushed the trust-source-idp branch 2 times, most recently from eaa2f60 to 831b5fa Compare May 11, 2026 11:46
@mposolda mposolda self-assigned this May 13, 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.

@dominikschlosser Nice, Thanks a lot!

Few comments.

  1. It may be better to use per-client configuration of IDPs rather than "global" configuration at the level of authenticator. Added inline comment with the details.

  2. Instead of introducing 2 new IDPs, would it be possible to introduce only single IDP like DefaultTrustIdentityProvider, which would have options aligned with the OIDC IDP? This means options like:

  • Use JWKS URL (On/off switch)
  • JWKS URL (Shown just when the previous is ON and it is mandatory in that case)
  • Validating public key id (Shown jsut when Use JWKS URL is off)
  • Validating public key (Shown just when Use JWKS URL is off)

This will be aligned with the OIDCIdentityProvider, which already uses those options (note they have tooltips already etc).

Also it can be nice if OIDCIdentityProvider itself implements TrustMaterialIdentityPRovider (or extends from AbstractJwksTrustIdentityProvider). Hopefully both IDP can somehow re-use same code/logic for obtain keys from "JWKS URL" or "hardcoded". WDYT?

For some inspiration, you can maybe take a look at the JWTAuthorizationGrantProvider. This one also has dedicated IDP impl (JWTAuthorizationGrantIdentityProvider) but at the same time, the OIDCIdentityProvider implements it. So this might have some consistency with that.

Also I think that new IDP does not need Client ID and Client secret as configuration options? (In your PR, both new IDPs have those). I guess you added those just by mistake or any need for them?

  1. I think it can be good if we re-use same mechanism like for ABCA also for the OID4VCI credential-request "proofs" to retrieve attestation keys. As those are currently also configured per-realm, which is not very flexible. But this may be good as a follow-up rather than this PR as this PR is already relatively big. Just for the reference. Related issue: #48414

jwks.setType(ProviderConfigProperty.TEXT_TYPE);
jwks.setHelpText("JWKS containing trusted attester public keys");
return List.of(jwks);
ProviderConfigProperty trustIdps = new ProviderConfigProperty();
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.

Is it possible to use the per-client configuration instead of using "global" configuration at the authenticator level?

As I think that in production, realm will have different clients/wallets, but each of them may need different attestation key. For example client my-wallet-1 and my-wallet-11 may need attestations from IDP idp1, when my-wallet2 will need attestations from IDP idp2 .

It should be possible to do this just by moving this config option to the method getConfigPropertiesPerClient() instead of getConfigProperties(). Then in the admin console, it will appear in the client credentials tab. See screenshot

Image

Also you can see for example FederatedJWTClientAuthenticator for some "inspiration" .

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.

  1. I will look into it, good suggestion
  2. The goal of this PR is just to illustrate the mechanism. I agree that there should be only one IdP-implementation for external JWKS and Cert configured in Keycloak itself. But this mechanism should also be extensible for other trust sources like ETSI Trust Lists in the future. Thats why i did it this way here.
  3. Yes i agree but that would be out-of-scope here

If you agree with the general direction i will rework this PR to be mergeable

@dominikschlosser
dominikschlosser marked this pull request as draft May 13, 2026 11:01
@mposolda
Copy link
Copy Markdown
Contributor

@dominikschlosser FYI. This will require rebase . Especially the change 6aeccb2 is related and will likely affect this PR as well, but hope in a positive way (as ABCA authenticator is now treated as proper client authenticator)

@dominikschlosser
dominikschlosser force-pushed the trust-source-idp branch 9 times, most recently from 376a966 to 4f42fe3 Compare May 22, 2026 07:27
@dominikschlosser dominikschlosser changed the title Draft: Introduce mechanism for different trust material sources Introduce mechanism for different trust material sources May 22, 2026
@dominikschlosser
dominikschlosser marked this pull request as ready for review May 22, 2026 07:38
@dominikschlosser
Copy link
Copy Markdown
Contributor Author

@mposolda Could you please review again? ABCA is included in this PR as first user of the new mechanism. There are of course more places where this can be used but that should be follow-up PRs.

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

@dominikschlosser Thanks!

I have few comments when testing your PR and I've ended up sending another PR to your branch dominikschlosser#1 :-) If you are ok with those changes and you merge that, this PR #48869 should be automatically updated. And from my point of view, this would be good to merge.

My changes in that other PR:

  • Make DefaultTrustIdentityProviderFactory available just when either ABCA or OID4VCI feature is enabled. As this is new thing and should be guarded behind the feature and moreover, it seems this IDP will be useful just if some of those features is also enabled (This PR uses it just for ABCA, but I think it may be useful just for other things as you mentioned. Like for example proofs in OID4VCI credential requests).

  • Removed some code duplications (Introduced JWKSServerUtils.toJwk and TrustKeyUtil.filterKeys). Especially the first one is important as we would need to support multiple key types in the near future (in relation to post-quantum cryptography) and would be nice if related "utility" code for stuff like converting KEyWrapper to JWK is on single place rather than requiring update of many places when new key-type is introduced...

  • Updated AttestationBasedClientAuthenticator config option to be required and use the type STRING_TYPE. I agree that IDENTITY_PROVIDER_MULTI_LIST_TYPE would be better, but it is currently broken in the admin console (See screenshot below). The STRING_TYPE is not so convenient, but it is OK for now as it is exactly the same what also Signed JWT- Federated client authenticator is using. It would be good to have follow-up issue to fix this (for both Signed JWT - Federated as well as Attestation-based), but I consider this out-of-scope of this PR (it is probably bug in the UI component and would require some changes in the admin console UI libraries to fix this...)

Image

Besides that, as a follow-up, it might be good to polish the configuration of Default-Trust Identity provider in the admin console. Right now, it requires configuration of Client ID and Client secret (which is non-sense for this IDP) . Also would be nice to make name of the "JWKS" related options consistent with other IDPs (OIDC Identity Provider, JWT Authorization grant provider). But that can be also a follow-up and not a blocker for this PR IMO...

@dominikschlosser
Copy link
Copy Markdown
Contributor Author

@mposolda Thank you!

Good suggestions and changes. I'm actually not sure where client-id/secret config comes from, otherwise i would have removed it...

@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.BruteForceTest#testMaxTemporaryLockoutsReset

Keycloak CI - Forms IT (chrome)

org.opentest4j.AssertionFailedError: Expected LoginPage but was localhost (https://localhost:8543/auth/realms/test/login-actions/authenticate?session_code=6AcrUM5z3MiXC6zxidyO7Fk3OygT0Wvg_ot5Fw0MEI8&execution=369c406a-b9ef-4bfe-8c18-28f108e04bc1&client_id=test-app&tab_id=1nVna6I5F3E&client_data=eyJydSI6Imh0dHBzOi8vbG9jYWxob3N0Ojg1NDMvYXV0aC9yZWFsbXMvbWFzdGVyL2FwcC9hdXRoIiwicnQiOiJjb2RlIn0) ==> 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

@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

dominikschlosser and others added 2 commits May 24, 2026 12:54
Signed-off-by: Dominik Schlosser <dominik.schlosser@gmail.com>
Signed-off-by: mposolda <mposolda@gmail.com>
@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.

@mposolda
mposolda merged commit a1bd1ab into keycloak:main May 25, 2026
87 checks passed
@mposolda
mposolda commented May 25, 2026 •
Copy link
Copy Markdown
Contributor

@dominikschlosser For tracking: Follow-up issues are #49281 (for configuration polishing) and #48414 (for use same mechanism for OID4VCI).

@stianst stianst mentioned this pull request Jun 1, 2026
sashyo pushed a commit to tide-foundation/keycloak-IGA that referenced this pull request Jul 20, 2026
)

closes keycloak#48269



Signed-off-by: Dominik Schlosser <dominik.schlosser@gmail.com>
Signed-off-by: mposolda <mposolda@gmail.com>
Co-authored-by: mposolda <mposolda@gmail.com>
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.

[ABCA] Doublecheck how to configure valid keys for client attestation authentication

3 participants

0