Commit graph

5725 commits

Author SHA1 Message Date
Awambeng Rodrick
b99f1b5842 fix(oid4vc): use SecureRandom for nonce and time claim generation
- replace non-cryptographic PRNG usage (java.util.Random, Math.random)
- use SecureRandom in JwtCNonceHandler for nonce length generation
- use SecureRandom in TimeClaimNormalizer for time claim randomization
- introduce centralized secure random utility (SecretGenerator)
- ensure uniform and unpredictable randomness in security-sensitive flows

Closes #47271

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>

Address review comments from @IngridPuppet

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
2026-03-26 17:44:47 +01:00
Simon Levermann
f4225b4f9b
Introduce traceId to freemarker attributes
Closes #44090
Closes #34435

Signed-off-by: Simon Levermann <github@simon.slevermann.de>
2026-03-26 17:42:32 +01:00
Stian Thorgersen
af942df712
Verify resource indicator syntax in authz and token endpoint (#47438)
Closes #47116, closes #47119

Signed-off-by: stianst <stianst@gmail.com>
2026-03-26 10:35:17 +01:00
Or Nissan
a3cc3c40fc Domain matching case-insensitive in organization identity provider
Signed-off-by: Or Nissan <orn@semperis.com>
2026-03-25 17:27:15 -03:00
Alexey Skosyrskiy
56cdb6b8ef Optimize composite client role mappings endpoint and migrate test
Pre-compute the full effective role set once in
ClientRoleMappingsResource.getCompositeClientRoleMappings() using
RoleUtils.getDeepRoleMappings(), then filter by client. This replaces
the previous O(C*M*D) approach of calling user.hasRole() for every
client role, which recursively expanded composites without memoization.

RoleUtils.getDeepRoleMappings(RoleMapperModel) is introduced to handle
both RoleMapperModel implementations correctly: UserModel includes
group-inherited roles (matching UserModel.hasRole() semantics), while
GroupModel expands only its direct composite mappings.

The CompositeClientRoleMappingsTest is migrated from the deprecated
Arquillian framework to the new Keycloak test framework (JUnit 5).

Signed-off-by: Alexey Skosyrskiy <askosyrskiy@metropolis.io>
2026-03-25 17:24:16 -03:00
Alexey Skosyrskiy
a9e7abb364 Optimize getCompositeClientRoleMappings from O(C*M*D) to O(M*D+C)
Pre-compute user's effective roles via RoleUtils.expandCompositeRoles()
(BFS) instead of calling user.hasRole() per client role which
recursively expands composites without memoization.

Closes #47157

Signed-off-by: Alexey Skosyrskiy <askosyrskiy@metropolis.io>
2026-03-25 17:24:16 -03:00
vramik
43864c1375 Disabled organization should not execute invitations
Closes #45760

Signed-off-by: vramik <vramik@redhat.com>
2026-03-25 17:04:23 -03:00
Ingrid Kamga
df92e7aac8
[OID4VCI] Generate pre-authorized codes using the JWT format (#46450)
Closes #45231


Signed-off-by: Ingrid Kamga <Ingrid.Kamga@adorsys.com>
Signed-off-by: Ingrid Kamga <xingridkamga@gmail.com>
2026-03-25 19:35:13 +01:00
Hager Khamis
13897b9b32
Adding getResourcesCommonUrl() to UrlBean (#47113)
I added getResourcesCommonUrl() following the same URL/Path pattern already used by getResourcesUrl() and getResourcesPath(). Email clients can't resolve relative paths so the existing getResourcesCommonPath() wasn't enough for email templates.

I also pulled out the common-path lookup into a private getCommonPath() helper to avoid duplicating it between getResourcesCommonPath() and the new method. Updated the theme docs with a usage example and a note about absolute URLs in emails.

Closes #33198

Signed-off-by: Hager Khamis <hagerm98@hotmail.com>
2026-03-25 07:45:52 +00:00
rmartinc
e9b27d04f5 Add option to store tokens in session for Identity Providers
Closes #47185

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-03-24 19:22:43 +01:00
Giuseppe Graziano
865edcea36 Client policies for identity brokering api
Closes #46585

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
2026-03-24 19:00:51 +01:00
Tomohiko Ozawa
6f25f41166
Improve UI for inviting realm users (#45731)
Closes #45704

Signed-off-by: Tomohiko Ozawa <kota65535@gmail.com>
2026-03-24 13:21:37 -04:00
Jakub Pietrzak
0369951480 Resolve nested keys in oauth2 identity provider claims
Signed-off-by: Jakub Pietrzak <jakub@pietrzak.dev>
2026-03-24 09:47:33 -03:00
mposolda
68f5779230 CVE-2026-3429 Improper Access Control for LoA During Credential Deletion for the case of client overriden flow
closes #47069

Signed-off-by: mposolda <mposolda@gmail.com>
2026-03-24 13:44:05 +01:00
vramik
db7d4d550c Do not reflect the organization name in the error message
Closes #47084

Signed-off-by: vramik <vramik@redhat.com>
2026-03-24 09:28:23 -03:00
Jonathan Langlois
a35f2a8bdb Allow mapped user attributes to be reset when broker claims are removed
Closes #44824

Signed-off-by: Jonathan Langlois <jonathan.langlois@gov.bc.ca>
2026-03-24 09:01:38 -03:00
vramik
a4796fe801 Add view-realm admin role check to SCIM discovery endpoints
Closes #46859

Signed-off-by: vramik <vramik@redhat.com>
2026-03-24 08:56:43 -03:00
Steven Hawkins
3c0c94f1d6
fix: reducing the cost of clear admin composite role cache
closes: #47139

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
2026-03-23 23:59:44 +01:00
Hisanobu Okuda
ce672801af
Clarify credentials field availability in GET /admin/realms/{realm}/users documentation
Closes #46972

Signed-off-by: Hisanobu Okuda <hisanobu.okuda@gmail.com>
2026-03-23 23:48:17 +01:00
Anil
569c2c35fb
Prevent querying all clients for dynamic scope update (#46545)
Some checks failed
Weblate Sync / Trigger Weblate to pull the latest changes (push) Has been cancelled
closes #46542


Signed-off-by: Anil Dhurjaty <anil.dhurjaty@appfolio.com>
2026-03-23 15:43:45 +01:00
Artem Mukhin
5a439cb1f6
Handle 'NullPointerException' thrown in 'DPoPUtil.validateDPoP' (#46849)
closes #46849


Signed-off-by: Artem Mukhin <amukhin@fobos-nt.ru>
2026-03-23 15:12:48 +01:00
rmartinc
fa79f27415 Chage identity brokering API V2 to only allow confidential clients
Closes #47256

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-03-23 14:40:41 +01:00
Giuseppe Graziano
b6b008c811 [OID4VCI] Improve signing key selection
Closes #45385

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
2026-03-23 10:26:45 +01:00
easonysliu
a7bd28c506 Fix NPE in ClientSecretRotationContext when client policy with client-updater-context exists
ClientSecretRotationContext was passing null for the AdminAuth parameter
to its parent constructor. When a client policy with the
client-updater-context condition is active, the condition evaluates
context.getToken() which delegates to adminAuth.getToken(), causing a
NullPointerException because adminAuth is null.

Pass the AdminAuth instance from the admin endpoint through to the
context constructor, consistent with how AdminClientUpdateContext and
other admin CRUD contexts are constructed elsewhere in ClientResource.

Closes #47063

Signed-off-by: easonysliu <easonysliu@tencent.com>
2026-03-23 09:28:53 +01:00
Thomas Diesler
53e7bdf1fe
[OID4VCI] Secure-by-Default and Default Disablement of Pre-Authorized… (#47270)
closes #46396


Signed-off-by: Thomas Diesler <tdiesler@proton.me>
2026-03-20 17:30:29 +01:00
Ricardo Martin
b93695eb90
Add versioning to identity brokering api feature (#47281)
Closes #47254

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-03-20 16:55:56 +01:00
Pedro Ruivo
c93b6a7e6c
Asynchronous server initialization
Closes #47187

Signed-off-by: Pedro Ruivo <1492066+pruivo@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Signed-off-by: Pedro Ruivo <pruivo@users.noreply.github.com>
Co-authored-by: Pedro Ruivo <1492066+pruivo@users.noreply.github.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Steven Hawkins <shawkins@redhat.com>
2026-03-19 21:23:46 +01:00
Thomas Diesler
762533ec49 [OID4VCI] Reduce log volume in CredentialScopeModelUtils
Signed-off-by: Thomas Diesler <tdiesler@proton.me>
2026-03-19 12:00:11 +01:00
mposolda
302ff9f7c2 [OID4VCI] Small inconsistencies in some events
Some checks failed
Weblate Sync / Trigger Weblate to pull the latest changes (push) Has been cancelled
closes #47203

Signed-off-by: mposolda <mposolda@gmail.com>
2026-03-18 18:46:48 +01:00
Stian Thorgersen
f4b701869a
Check refresh request resource param matches original resource param. (#47258)
Includes some NPE fixes (no client attribute) and refactors handling of verifying authz request resource param matching token request resource param.

Closes #47180

Signed-off-by: stianst <stianst@gmail.com>
2026-03-18 15:36:57 +01:00
Pedro Igor
aba0b71ea2
Enforce realm admin roles and permission when managing resources
Some checks are pending
Weblate Sync / Trigger Weblate to pull the latest changes (push) Waiting to run
Closes #47072

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
2026-03-17 20:30:25 +01:00
Peter Skopek
d11136f671 Separate password and OTP brute force protection to prevent OTP bypass attacks by default
Closes #46164

Signed-off-by: Peter Skopek <peter.skopek@ibm.com>

Update model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/changes/remote/updater/loginfailures/LoginFailuresUpdater.java

Co-authored-by: Pedro Ruivo <pruivo@users.noreply.github.com>
Signed-off-by: Peter Skopek <peter.skopek@ibm.com>

Add recovery codes to the list of brute force checked authenticators.

Closes #46164
Signed-off-by: Peter Skopek <peter.skopek@ibm.com>
2026-03-17 18:57:37 +01:00
Ricardo Martin
3c7582f318
Broker token API for saml (#47087)
Closes #46589


Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-03-17 18:29:48 +01:00
Christian Ja
2526548ce5
support locale in reset-credentials direct link
closes #44784

Signed-off-by: Christian Janker <christian.janker@gmx.at>
2026-03-17 13:49:14 +01:00
Marek Posolda
a52a1e7125
Reduce tightly coupling between client policy contexts and ClientScope condition (#47014)
Some checks are pending
Weblate Sync / Trigger Weblate to pull the latest changes (push) Waiting to run
closes #46936


Signed-off-by: mposolda <mposolda@gmail.com>
2026-03-17 12:56:15 +01:00
Stian Thorgersen
ca2bc8bd69
Initial experimental support for Resource Indicators (#46763)
* Initial experimental support for Resource Indicators

Closes #47040

Signed-off-by: stianst <stianst@gmail.com>

# Conflicts:
#	services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java
#	tests/utils-shared/src/main/java/org/keycloak/testsuite/util/oauth/LoginUrlBuilder.java

* Rename TokenInterceptor to TokenPostProcessor

Signed-off-by: stianst <stianst@gmail.com>

---------

Signed-off-by: stianst <stianst@gmail.com>
2026-03-17 08:45:56 +01:00
Marek Posolda
c4a630da6d
[OID4VCI] User self-issued credential: Issuance initiated from web po… (#46327)
closes #46196

Signed-off-by: mposolda <mposolda@gmail.com>
2026-03-17 08:41:16 +01:00
vramik
529c1a9009 Ensure get organizations by member id requires managing realm
Closes #47062

Signed-off-by: vramik <vramik@redhat.com>
2026-03-16 11:21:14 -03:00
vramik
be25654ff1 Add support for subGroupCount for children endpoint for Org Groups
Closes #47108

Signed-off-by: vramik <vramik@redhat.com>
2026-03-16 10:14:01 -03:00
vramik
bcebc246fa Ensure org group membership checks the org the user is member of
Closes #47137

Signed-off-by: vramik <vramik@redhat.com>
2026-03-16 09:59:57 -03:00
Stefan Guilhen
5d37617911 Fix ImmutableAttributeValidator so that email is set to lowercase form before comparison
Closes #47114

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
2026-03-13 11:06:16 -03:00
vramik
4455f01f13 Do not allow managing invitations if not an invitation of the current organization
Closes #47080

Signed-off-by: vramik <vramik@redhat.com>
2026-03-13 11:00:30 -03:00
Giuseppe Graziano
238ddd331e Client config for external tokens
Closes #46583

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
2026-03-13 14:49:42 +01:00
Thomas Diesler
102e3c3228
[OID4VCI] Add CredentialOfferProvider as single entry for offer creation - Part5 (#46951)
closes #47151


Signed-off-by: Thomas Diesler <tdiesler@proton.me>
2026-03-13 14:42:20 +01:00
Jonathan C
de3d8549d2
Add suport for filtering Components by providerId
Closes #45877

Signed-off-by: Jonathan Ciak <jonathan.ciak@gtri.gatech.edu>
2026-03-13 12:17:57 +00:00
Oluwatobi Mustapha
2e65ffbdd5
Enforce org membership on member organizations endpoint
Signed-off-by: Oluwatobi Mustapha <oluwatobimustapha539@gmail.com>
2026-03-13 11:57:44 +01:00
Thomas Diesler
6efb394398
[OID4VCI] Add support for authorization_code grant - Part4 (#46950)
closes #47100


Signed-off-by: Thomas Diesler <tdiesler@proton.me>
Signed-off-by: mposolda <mposolda@gmail.com>
Co-authored-by: mposolda <mposolda@gmail.com>
2026-03-12 16:09:42 +01:00
Tero Saarni
b2a88bcb3d
Add client certificate lookup for Envoy proxy (#33159)
* Add client certificate lookup for Envoy proxy

This update introduces the ability to lookup X509 client certificates from
Envoy's x-forwarded-client-cert header, using either the Cert or Chain
parameters.

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

* added junit test cases for envoy x509 lookup

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

* Run spotless

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

* Added support for proxy-trusted-addresses

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

* Convert exception to SecurityException for invalid headers

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

* document update

Signed-off-by: Tero Saarni <tero.saarni@est.tech>

---------

Signed-off-by: Tero Saarni <tero.saarni@est.tech>
2026-03-12 14:08:39 +01:00
Thomas Darimont
6c89f8d1be
Allow to expose WellKnown provider via ServerMetadataResource (#46292) (#46483)
* Allow exposing WellKnown providers via ServerMetadataResource (#46292)

Add new availableViaServerMetadata default method to WellKnownProviderFactory to control the availability of via '/.well-known/<alias>'.
Defaults to false, order to keep the behavior as before.
Also update the existing provider factories to let they decide if they need to be exposed on the root .well-known or not.

Fixes #46292

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Resolve WellKnownProviderFactory by alias and update provider logic

Introduce `WellKnownProviderUtil.resolveFromAlias(..)` to centralize alias-based factory resolution with priority ordering. Adjust `ServerMetadataResource` and `RealmsResource` to use the new method, replacing direct alias resolution logic. Streamline handling of aliases for consistent provider behavior.

Fixes #46292

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Rename methods in `ServerMetadataResource` for consistency

Align method names with streamlined naming conventions by replacing `getOAuth2AuthorizationServerWellKnownVersionPreflight` with `getWellKnownPreflight` and `getOAuth2AuthorizationServerWellKnown` with `getWellKnown`.

Fixes #46292

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Add test to verify `.well-known/openid-configuration` is not exposed via server metadata root by default.

Ensures an HTTP 404 response when the configuration is accessed with incorrect settings.

Fixes #46292

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Use more idiomatic nullcheck in ServerMetadataResource isValidProvider

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Format ServerMetadataResource

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Added wellKnownProviderUrl method to ServerMetadataResource

We could also have non-oauth well-known providers.
Marked the old wellKnownOAuthProviderUrl as deprecated.
Changed current call-sites to use wellKnownProviderUrl.

Fixes #46292

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* Optimize lookup in WellKnownProviderUtil.resolveFromAlias(..)

Fixes #46494

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

---------

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
2026-03-12 09:57:52 +01:00
vramik
3db694ca5b Search for organization group membership ignores search param
Closes #47051

Signed-off-by: vramik <vramik@redhat.com>
2026-03-11 10:26:27 -03:00