Previously, a RealmConfigInterceptor applied to every realm created within a test class, and it couldn't distinguish which realm it is decorating.
AbstractInterceptorHelper contains now an applies(..) filter that defaults to true, and Interception exposes the interceptor annotation, which is available whether or not the interceptor has been deployed. An interception that does not apply is skipped before it is applied, logged, or registered as a dependent of the intercepted instance. RealmConfigInterceptor exposes this as appliesTo(..).
Existing interceptors inherit the default and keep applying to every realm.
Closes#51751Closes#51752
Signed-off-by: Bernhard Strähle <bernhard.straehle@gmail.com>
* Do not chek critical status for key usage validations.
Provide perovider options for backwards compatibility.
Closes#52982
Signed-off-by: rmartinc <rmartinc@redhat.com>
* Move X509BrowserLoginTest and X509DirectGrantTest to the new CI
Closes#52982
Signed-off-by: rmartinc <rmartinc@redhat.com>
* Migrate tests to the new CI
Closes#52982
Signed-off-by: rmartinc <rmartinc@redhat.com>
* Do not initialize stores is tls is not enabled in ManagedCertificates
Closes#52982
Signed-off-by: rmartinc <rmartinc@redhat.com>
---------
Signed-off-by: rmartinc <rmartinc@redhat.com>
sendResponseHeaders transmits the header block, so the headers the caller passed
were being added to the response after it had already gone out and never reached
the client. The only current caller does not assert on them, which is why this
went unnoticed.
Also: Fix that responses without a body don't have a transfer encoding.
Closes#52362
Signed-off-by: lorexoff <rocca.lorenzo04@gmail.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
* Move ConditionalCredentialAuthenticatorTest to the new testsuite
Closes: #52070
Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
* logout after each test in favor of lifecycle=method
Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
---------
Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
InviteOrgActionTokenHandler sets the organization on the request context
in preHandleToken, which is only reached through
LoginActionsService.preHandleActionToken and so only runs on the
registration entry points. An invitee who already has an account opens
the action token URL, which executeActionToken dispatches straight to
handleToken, leaving the context organization unset.
Organizations.resolveOrganization then has neither a context
organization nor an ORGANIZATION_ATTRIBUTE auth note, falls through to
the membership check an invitee cannot pass yet, and returns null, so
FreeMarkerLoginFormsProvider leaves org out of the login form model.
An organization aware theme therefore cannot brand the confirm
membership page and can only name the organization by its name.
Set it in handleToken as well, under the same rule as preHandleToken:
for an existing member, or once the invitation is known to be valid, so
a revoked or expired link does not expose the organization's
attributes.
Cover it from the new test framework, with an organization login theme
in the custom providers that prints what the org bean exposes, and give
RealmBuilder a loginTheme option so the test can select that theme.
Closes#52396
Signed-off-by: Alexis Rico <sferadev@gmail.com>
* Moving user/profile tests to the new test suite
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Migrate user-profile tests to test framework
Move the user-profile migration for issue #50768 to the new test framework APIs, including the custom user-profile provider wiring. Fix provider deployment and registration page behavior needed to keep the migrated tests stable.
Closes#50768
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Add user package to base test suites
Include org.keycloak.tests.user in Base3TestSuite so the base suites coverage check recognizes the migrated user-profile package.
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Apply Spotless formatting for user-profile migration
Reorder imports in migrated user-profile tests to satisfy spotless:check in Keycloak CI.
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Remove user package from legacy base-suite matrix
Drop the obsolete testsuite user package entry from the legacy base-suite shard list now that user/profile tests are migrated to tests/base.
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Skip body staleness wait for HtmlUnit page reloads
HtmlUnit form submission is synchronous, so waiting for the body element to become stale after login submit times out and makes SessionRestServiceTest flaky in Base2TestSuite.
Closes#52283
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Restore SMTP config after validation test and fix WaitUtils compile error
Prevent class-scoped realm state from leaking allowutf8=true to later
UserProfileTest methods, and remove orphaned merge code that broke
test-framework/ui compilation.
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
* Address PR review feedback for user-profile test migration
Restore UPConfig after registration UI tests and run UPConfigUtilsTest as a plain unit test without booting Keycloak.
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
---------
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Chrome CDP throws "Node with given id does not belong to the document" instead of StaleElementReferenceException.
Closes#52415
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
* Fix DistributionKeycloakServer hanging on Windows when server startup is slow
Closes#51790
Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
* Fix DistributionKeycloakServer hanging on Windows when server startup is slow
Closes#51790
Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
---------
Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Add missing builder methods to IdentityProviderBuilder and
introduce IdentityProviderMapperBuilder to provide a fluent API
consistent with the rest of the RealmBuilder DSL.
Closes#51359
Signed-off-by: Francesco Poli <polifr@gmail.com>