Skip to content

Commit 8ab7487

Browse files
authored
Merge pull request #79 from fschmtt/keycloak-23
Keycloak 23 support
2 parents 176cb89 + 7088797 commit 8ab7487

File tree

7 files changed

+32
-16
lines changed

7 files changed

+32
-16
lines changed

.github/workflows/php-integration.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
keycloak: [17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 22.0.5]
15+
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]
1616

1717
env:
1818
KEYCLOAK_VERSION: ${{ matrix.keycloak }}

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
![PHP Legacy (Keycloak compatibility)](https://github.com/fschmtt/keycloak-rest-api-client-php/actions/workflows/php-integration-legacy.yml/badge.svg?branch=main)
66

77
# Keycloak Admin REST API Client
8-
PHP client to interact with [Keycloak's Admin REST API](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html).
8+
PHP client to interact with [Keycloak's Admin REST API](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html).
99

1010
Inspired by [keycloak/keycloak-nodejs-admin-client](https://github.com/keycloak/keycloak-nodejs-admin-client).
1111

@@ -43,28 +43,28 @@ echo sprintf(
4343
```
4444
will print e.g.
4545
```text
46-
Keycloak 22.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.
46+
Keycloak 23.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.
4747
```
4848

4949
More examples can be found in the [examples](examples) directory.
5050

5151
## Available Resources
52-
### [Attack Detection](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_attack_detection_resource)
52+
### [Attack Detection](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_attack_detection_resource)
5353
| Endpoint | Response | API |
5454
|----------|----------|-----|
5555
| `DELETE /admin/realms/{realm}/attack-detection/brute-force/users` | `n/a` | [AttackDetection::clear()](src/Resource/AttackDetection.php) |
5656
| `GET /admin/realms/{realm}/attack-detection/brute-force/users/{userId}` | [Map](src/Type/Map.php) | [AttackDetection::userStatus()](src/Resource/AttackDetection.php) |
5757
| `DELETE /admin/realms/{realm}/attack-detection/brute-force/users/{userId}` | `n/a` | [AttackDetection::clearUser()](src/Resource/AttackDetection.php) |
5858

59-
### [Clients](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_clients_resource)
59+
### [Clients](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_clients_resource)
6060
| Endpoint | Response | API |
6161
|----------|----------|-----|
6262
| `GET /admin/realms/{realm}/clients` | [ClientCollection](src/Collection/ClientCollection.php) | [Clients::all()](src/Resource/Clients.php) |
6363
| `GET /admin/realms/{realm}/clients/{id}` | [Client](src/Representation/Client.php) | [Clients::get()](src/Resource/Clients.php) |
6464
| `PUT /admin/realms/{realm}/clients/{id}` | [Client](src/Representation/Client.php) | [Clients::update()](src/Resource/Clients.php) |
6565
| `POST /admin/realms/{realm}/clients` | [Client](src/Representation/Client.php) | [Clients::import()](src/Resource/Clients.php) |
6666

67-
### [Groups](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_clients_resource)
67+
### [Groups](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_clients_resource)
6868
| Endpoint | Response | API |
6969
|----------|----------|-----|
7070
| `GET /admin/realms/{realm}/groups` | [GroupCollection](src/Collection/GroupCollection.php) | [Groups::all()](src/Resource/Groups.php) |
@@ -73,7 +73,7 @@ More examples can be found in the [examples](examples) directory.
7373
| `POST /admin/realms/{realm}/groups` | `n/a` | [Groups::import()](src/Resource/Groups.php) |
7474
| `DELETE /admin/realms/{realm}/groups` | `n/a` | [Groups::delete()](src/Resource/Groups.php) |
7575

76-
### [Realms Admin](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_realms_admin_resource)
76+
### [Realms Admin](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_realms_admin_resource)
7777
| Endpoint | Response | API |
7878
|----------|----------|-----|
7979
| `POST /admin/realms` | [Realm](src/Representation/Realm.php) | [Realms::import()](src/Resource/Realms.php) |
@@ -86,7 +86,7 @@ More examples can be found in the [examples](examples) directory.
8686
| `POST /admin/realms/{realm}/clear-realm-cache` | `n/a` | [Realms::clearRealmCache()](src/Resource/Realms.php) |
8787
| `POST /admin/realms/{realm}/clear-user-cache` | `n/a` | [Realms::clearUserCache()](src/Resource/Realms.php) |
8888

89-
### [Users](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_users_resource)
89+
### [Users](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_users_resource)
9090
| Endpoint | Response | API |
9191
|----------|----------|-----|
9292
| `GET /admin/realms/{realm}/users` | [UserCollection](src/Collection/UserCollection.php) | [Users::all()](src/Resource/Users.php) |
@@ -104,15 +104,15 @@ More examples can be found in the [examples](examples) directory.
104104
| `DELETE /{realm}/users/{id}/role-mappings/realm` | `n/a` | [Users::removeRealmRoles()](src/Resource/Users.php) |
105105
| `PUT /{realm}/users/{id}/execute-actions-email` | `n/a` | [Users::executeActionsEmail()](src/Resource/Users.php) |
106106

107-
### [Roles](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_roles_resource)
107+
### [Roles](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_roles_resource)
108108
| Endpoint | Response | API |
109109
|----------|----------|-----|
110110
| `GET /admin/realms/{realm}/roles` | [RoleCollection](src/Collection/RoleCollection.php) | [Roles::all()](src/Resource/Roles.php) |
111111
| `GET /admin/realms/{realm}/roles/{roleName}` | [Role](src/Representation/Role.php) | [Roles::get()](src/Resource/Roles.php) |
112112
| `POST /admin/realms/{realm}/roles` | `n/a` | [Roles::create()](src/Resource/Roles.php) |
113113
| `DELETE /admin/realms/{realm}/roles/{roleName}` | `n/a` | [Roles::delete()](src/Resource/Roles.php) |
114114

115-
### [Root](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_root_resource)
115+
### [Root](https://www.keycloak.org/docs-api/23.0.0/rest-api/index.html#_root_resource)
116116
| Endpoint | Response | API |
117117
|----------|----------|-----|
118118
| `GET /admin/serverinfo` | [ServerInfo](src/Representation/ServerInfo.php) | [ServerInfo::get()](src/Resource/ServerInfo.php) |

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
working_dir: /app
1111

1212
keycloak:
13-
image: quay.io/keycloak/keycloak:22.0.0
13+
image: quay.io/keycloak/keycloak:23.0.0
1414
command: start-dev
1515
environment:
1616
KEYCLOAK_ADMIN: admin

docker/keycloak/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG KEYCLOAK_VERSION=22.0.0
1+
ARG KEYCLOAK_VERSION=23.0.0
22
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION}
33

44
ENTRYPOINT [ "/opt/keycloak/bin/kc.sh", "start-dev" ]

src/Representation/Group.php

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Fschmtt\Keycloak\Representation;
66

7+
use Fschmtt\Keycloak\Attribute\Since;
78
use Fschmtt\Keycloak\Collection\GroupCollection;
89
use Fschmtt\Keycloak\Type\Map;
910

@@ -15,6 +16,7 @@
1516
* @method string|null getName()
1617
* @method string|null getPath()
1718
* @method string[]|null getRealmRoles()
19+
* @method int|null getSubGroupCount()
1820
* @method Group[]|null getSubGroups()
1921
* @method self withAccess(?Map $access)
2022
* @method self withAttributes(?Map $attributes)
@@ -23,6 +25,7 @@
2325
* @method self withName(?string $name)
2426
* @method self withPath(?string $path)
2527
* @method self withRealmRoles(?array $realmRoles)
28+
* @method self withSubGroupCount(?int $subGroupCount)
2629
* @method self withSubGroups(?array $subGroups)
2730
*
2831
* @codeCoverageIgnore
@@ -38,6 +41,8 @@ public function __construct(
3841
protected ?string $path = null,
3942
/** @var string[]|null */
4043
protected ?array $realmRoles = null,
44+
#[Since('23.0.0')]
45+
protected ?int $subGroupCount = null,
4146
protected ?GroupCollection $subGroups = null,
4247
) {
4348
}

src/Representation/Realm.php

+10
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@
129129
* @method string|null getWebAuthnPolicyAuthenticatorAttachment()
130130
* @method bool|null getWebAuthnPolicyAvoidSameAuthenticatorRegister()
131131
* @method int|null getWebAuthnPolicyCreateTimeout()
132+
* @method string[]|null getWebAuthnPolicyExtraOrigins()
132133
* @method array|null getWebAuthnPolicyPasswordlessAcceptableAaguids()
133134
* @method string|null getWebAuthnPolicyPasswordlessAttestationConveyancePreference()
134135
* @method string|null getWebAuthnPolicyPasswordlessAuthenticatorAttachment()
135136
* @method bool|null getWebAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister()
136137
* @method int|null getWebAuthnPolicyPasswordlessCreateTimeout()
138+
* @method string[]|null getWebAuthnPolicyPasswordlessPolicyExtraOrigins()
137139
* @method string|null getWebAuthnPolicyPasswordlessRequireResidentKey()
138140
* @method string|null getWebAuthnPolicyPasswordlessRpEntityName()
139141
* @method string|null getWebAuthnPolicyPasswordlessRpId()
@@ -252,11 +254,13 @@
252254
* @method self withWebAuthnPolicyAuthenticatorAttachment(?string $value)
253255
* @method self withWebAuthnPolicyAvoidSameAuthenticatorRegister(?bool $value)
254256
* @method self withWebAuthnPolicyCreateTimeout(?int $value)
257+
* @method self withWebAuthnPolicyExtraOrigins(?array $value)
255258
* @method self withWebAuthnPolicyPasswordlessAcceptableAaguids(?array $value)
256259
* @method self withWebAuthnPolicyPasswordlessAttestationConveyancePreference(?string $value)
257260
* @method self withWebAuthnPolicyPasswordlessAuthenticatorAttachment(?string $value)
258261
* @method self withWebAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister(?bool $value)
259262
* @method self withWebAuthnPolicyPasswordlessCreateTimeout(?int $value)
263+
* @method self withWebAuthnPolicyPasswordlessExtraOrigins(?array $value)
260264
* @method self withWebAuthnPolicyPasswordlessRequireResidentKey(?string $value)
261265
* @method self withWebAuthnPolicyPasswordlessRpEntityName(?string $value)
262266
* @method self withWebAuthnPolicyPasswordlessRpId(?string $value)
@@ -392,11 +396,17 @@ public function __construct(
392396
protected ?bool $webAuthnPolicyAvoidSameAuthenticatorRegister = null,
393397
protected ?int $webAuthnPolicyCreateTimeout = null,
394398
/** @var string[]|null */
399+
#[Since('23.0.0')]
400+
protected ?array $webAuthnPolicyExtraOrigins = null,
401+
/** @var string[]|null */
395402
protected ?array $webAuthnPolicyPasswordlessAcceptableAaguids = null,
396403
protected ?string $webAuthnPolicyPasswordlessAttestationConveyancePreference = null,
397404
protected ?string $webAuthnPolicyPasswordlessAuthenticatorAttachment = null,
398405
protected ?bool $webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister = null,
399406
protected ?int $webAuthnPolicyPasswordlessCreateTimeout = null,
407+
/** @var string[]|null */
408+
#[Since('23.0.0')]
409+
protected ?array $webAuthnPolicyPasswordlessExtraOrigins = null,
400410
protected ?string $webAuthnPolicyPasswordlessRequireResidentKey = null,
401411
protected ?string $webAuthnPolicyPasswordlessRpEntityName = null,
402412
protected ?string $webAuthnPolicyPasswordlessRpId = null,

tests/Unit/Http/PropertyFilterTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testDoesNotFilterPropertiesIfVersionIsNotProvided(): void
2727
}
2828

2929
/**
30-
* @dataProvider keycloakVersions
30+
* @dataProvider supportedKeycloakVersions
3131
*/
3232
public function testFiltersOutPropertyWhichHasNotYetBeenIntroduced(string $version): void
3333
{
@@ -42,7 +42,7 @@ public function testFiltersOutPropertyWhichHasNotYetBeenIntroduced(string $versi
4242
}
4343

4444
/**
45-
* @dataProvider keycloakVersions
45+
* @dataProvider supportedKeycloakVersions
4646
*/
4747
public function testFiltersOutPropertyWhichHasBeenRemoved(string $version): void
4848
{
@@ -57,7 +57,7 @@ public function testFiltersOutPropertyWhichHasBeenRemoved(string $version): void
5757
}
5858

5959
/**
60-
* @dataProvider keycloakVersions
60+
* @dataProvider supportedKeycloakVersions
6161
*/
6262
public function testFiltersOutPropertyWhichHasBeenIntroducedAndRemoved(string $version): void
6363
{
@@ -89,7 +89,7 @@ public function testMemoizesFilteredPropertiesOfRepresentation(): void
8989
static::assertArrayHasKey($representation::class, $memoizedFilteredProperties);
9090
}
9191

92-
public static function keycloakVersions(): Generator
92+
public static function supportedKeycloakVersions(): Generator
9393
{
9494
yield ['13.0.0'];
9595
yield ['14.0.0'];
@@ -101,5 +101,6 @@ public static function keycloakVersions(): Generator
101101
yield ['20.0.0'];
102102
yield ['21.0.0'];
103103
yield ['22.0.0'];
104+
yield ['23.0.0'];
104105
}
105106
}

0 commit comments

Comments
 (0)