From 85999a19512c9bb7dd9a7b3c6885b7341bd16dac Mon Sep 17 00:00:00 2001 From: fschmtt Date: Thu, 13 Jun 2024 12:31:21 +0200 Subject: [PATCH 1/3] Add support for Keycloak 25 #110 --- .github/workflows/php-integration.yml | 2 +- README.md | 18 +++++++++--------- docker-compose.yml | 2 +- docker/keycloak/Dockerfile | 2 +- tests/Unit/Http/PropertyFilterTest.php | 1 + 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/php-integration.yml b/.github/workflows/php-integration.yml index c9226d97..ae75a4a9 100644 --- a/.github/workflows/php-integration.yml +++ b/.github/workflows/php-integration.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - keycloak: [17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 22.0.5, 23.0.0, 24.0.0] + keycloak: [17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 22.0.5, 23.0.0, 24.0.0, 25.0.0] php: [ 8.1 ] env: diff --git a/README.md b/README.md index 77396b60..4c03b23e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # Keycloak Admin REST API Client -PHP client to interact with [Keycloak's Admin REST API](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html). +PHP client to interact with [Keycloak's Admin REST API](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html). Inspired by [keycloak/keycloak-nodejs-admin-client](https://github.com/keycloak/keycloak-nodejs-admin-client). @@ -49,7 +49,7 @@ echo sprintf( will print e.g. ```text -Keycloak 24.0.0 is running on Linux/5.10.25-linuxkit (amd64) with OpenJDK 64-Bit Server VM/11.0.11 since 0 days, 2 hours, 37 minutes, 7 seconds and is currently using 139 MB of 512 MB (28 %) memory. +Keycloak 25.0.0 is running on Linux/5.10.25-linuxkit (amd64) with OpenJDK 64-Bit Server VM/11.0.11 since 0 days, 2 hours, 37 minutes, 7 seconds and is currently using 139 MB of 512 MB (28 %) memory. ``` More examples can be found in the [examples](examples) directory. @@ -104,7 +104,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); ## Available Resources -### [Attack Detection](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_attack_detection) +### [Attack Detection](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_attack_detection) | Endpoint | Response | API | |----------------------------------------------------------------------------|-------------------------|-------------------------------------------------------------------| @@ -112,7 +112,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `GET /admin/realms/{realm}/attack-detection/brute-force/users/{userId}` | [Map](src/Type/Map.php) | [AttackDetection::userStatus()](src/Resource/AttackDetection.php) | | `DELETE /admin/realms/{realm}/attack-detection/brute-force/users/{userId}` | `n/a` | [AttackDetection::clearUser()](src/Resource/AttackDetection.php) | -### [Clients](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_clients) +### [Clients](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_clients) | Endpoint | Response | API | |---------------------------------------------------|---------------------------------------------------------|-----------------------------------------------| @@ -121,7 +121,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `PUT /admin/realms/{realm}/clients/{client-uuid}` | [Client](src/Representation/Client.php) | [Clients::update()](src/Resource/Clients.php) | | `POST /admin/realms/{realm}/clients` | [Client](src/Representation/Client.php) | [Clients::import()](src/Resource/Clients.php) | -### [Groups](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_clients) +### [Groups](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_clients) | Endpoint | Response | API | |---------------------------------------------------|-------------------------------------------------------|-----------------------------------------------| @@ -133,7 +133,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `POST /admin/realms/{realm}/groups/{id}/children` | `n/a` | [Groups::create()](src/Resource/Groups.php) | | `DELETE /admin/realms/{realm}/groups` | `n/a` | [Groups::delete()](src/Resource/Groups.php) | -### [Realms Admin](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_realms_admin) +### [Realms Admin](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_realms_admin) | Endpoint | Response | API | |------------------------------------------------|-------------------------------------------------------|--------------------------------------------------------| @@ -148,7 +148,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `POST /admin/realms/{realm}/clear-realm-cache` | `n/a` | [Realms::clearRealmCache()](src/Resource/Realms.php) | | `POST /admin/realms/{realm}/clear-user-cache` | `n/a` | [Realms::clearUserCache()](src/Resource/Realms.php) | -### [Users](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_users) +### [Users](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_users) | Endpoint | Response | API | |---------------------------------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------| @@ -168,7 +168,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `PUT /{realm}/users/{id}/execute-actions-email` | `n/a` | [Users::executeActionsEmail()](src/Resource/Users.php) | | `GET /admin/realms/{realm}/users/{userId}/credentials` | [CredentialCollection](src/Collection/CredentialCollection.php) | [Users::credentials()](src/Resource/Users.php) | -### [Roles](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_roles) +### [Roles](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_roles) | Endpoint | Response | API | |-------------------------------------------------|-----------------------------------------------------|-------------------------------------------| @@ -177,7 +177,7 @@ $myCustomRepresentation = $myCustomResource->myCustomEndpoint(); | `POST /admin/realms/{realm}/roles` | `n/a` | [Roles::create()](src/Resource/Roles.php) | | `DELETE /admin/realms/{realm}/roles/{roleName}` | `n/a` | [Roles::delete()](src/Resource/Roles.php) | -### [Root](https://www.keycloak.org/docs-api/24.0.0/rest-api/index.html#_root) +### [Root](https://www.keycloak.org/docs-api/25.0.0/rest-api/index.html#_root) | Endpoint | Response | API | |-------------------------|-------------------------------------------------|--------------------------------------------------| diff --git a/docker-compose.yml b/docker-compose.yml index dbb9c08c..81a13ec6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: working_dir: /app keycloak: - image: quay.io/keycloak/keycloak:24.0.0 + image: quay.io/keycloak/keycloak:25.0.0 command: start-dev environment: KEYCLOAK_ADMIN: admin diff --git a/docker/keycloak/Dockerfile b/docker/keycloak/Dockerfile index 8a296bab..fc86fb98 100644 --- a/docker/keycloak/Dockerfile +++ b/docker/keycloak/Dockerfile @@ -1,4 +1,4 @@ -ARG KEYCLOAK_VERSION=24.0.0 +ARG KEYCLOAK_VERSION=25.0.0 FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} ENTRYPOINT [ "/opt/keycloak/bin/kc.sh", "start-dev" ] diff --git a/tests/Unit/Http/PropertyFilterTest.php b/tests/Unit/Http/PropertyFilterTest.php index 62f5dfd5..ed7db666 100644 --- a/tests/Unit/Http/PropertyFilterTest.php +++ b/tests/Unit/Http/PropertyFilterTest.php @@ -98,5 +98,6 @@ public static function supportedKeycloakVersions(): Generator yield ['22.0.0']; yield ['23.0.0']; yield ['24.0.0']; + yield ['25.0.0']; } } From 43e624e572e78be460c7b009738cfdf73f98b55c Mon Sep 17 00:00:00 2001 From: fschmtt Date: Thu, 13 Jun 2024 13:37:07 +0200 Subject: [PATCH 2/3] Add representations and collections for Organization and OrganizationDomain and corresponding collections --- src/Collection/OrganizationCollection.php | 20 +++++++++++++++ .../OrganizationDomainCollection.php | 20 +++++++++++++++ src/Representation/Organization.php | 25 +++++++++++++++++++ src/Representation/OrganizationDomain.php | 14 +++++++++++ src/Representation/Realm.php | 5 ++++ 5 files changed, 84 insertions(+) create mode 100644 src/Collection/OrganizationCollection.php create mode 100644 src/Collection/OrganizationDomainCollection.php create mode 100644 src/Representation/Organization.php create mode 100644 src/Representation/OrganizationDomain.php diff --git a/src/Collection/OrganizationCollection.php b/src/Collection/OrganizationCollection.php new file mode 100644 index 00000000..d0ffbaac --- /dev/null +++ b/src/Collection/OrganizationCollection.php @@ -0,0 +1,20 @@ + + * + * @codeCoverageIgnore + */ +class OrganizationCollection extends Collection +{ + public static function getRepresentationClass(): string + { + return Organization::class; + } +} diff --git a/src/Collection/OrganizationDomainCollection.php b/src/Collection/OrganizationDomainCollection.php new file mode 100644 index 00000000..39a49268 --- /dev/null +++ b/src/Collection/OrganizationDomainCollection.php @@ -0,0 +1,20 @@ + + * + * @codeCoverageIgnore + */ +class OrganizationDomainCollection extends Collection +{ + public static function getRepresentationClass(): string + { + return OrganizationDomain::class; + } +} diff --git a/src/Representation/Organization.php b/src/Representation/Organization.php new file mode 100644 index 00000000..54c1adf5 --- /dev/null +++ b/src/Representation/Organization.php @@ -0,0 +1,25 @@ + Date: Thu, 13 Jun 2024 13:59:52 +0200 Subject: [PATCH 3/3] Add httpTimeout for iFaxity/wait-on-action --- .github/workflows/php-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/php-integration.yml b/.github/workflows/php-integration.yml index ae75a4a9..89267a16 100644 --- a/.github/workflows/php-integration.yml +++ b/.github/workflows/php-integration.yml @@ -50,6 +50,7 @@ jobs: uses: iFaxity/wait-on-action@v1 with: resource: ${{ env.KEYCLOAK_BASE_URL }} + httpTimeout: 30000 - name: Wait some more for Keycloak 24.0.0 zZz if: ${{ matrix.keycloak == '24.0.0' }}