Skip to content

Commit 242fc4d

Browse files
authored
Merge pull request #69 from fschmtt/keycloak-22
Add compatibility for Keycloak 22
2 parents cb1ff8f + b37c0d2 commit 242fc4d

File tree

74 files changed

+178
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+178
-135
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]
15+
keycloak: [17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0]
1616

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

README.md

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

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

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

@@ -42,28 +42,28 @@ echo sprintf(
4242
```
4343
will print e.g.
4444
```text
45-
Keycloak 21.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.
45+
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.
4646
```
4747

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

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

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

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

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

88-
### [Users](https://www.keycloak.org/docs-api/21.0.0/rest-api/index.html#_users_resource)
88+
### [Users](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_users_resource)
8989
| Endpoint | Response | API |
9090
|----------|----------|-----|
9191
| `GET /admin/realms/{realm}/users` | [UserCollection](src/Collection/UserCollection.php) | [Users::all()](src/Resource/Users.php) |
@@ -102,15 +102,15 @@ More examples can be found in the [examples](examples) directory.
102102
| `POST /{realm}/users/{id}/role-mappings/realm` | `n/a` | [Users::addRealmRoles()](src/Resource/Users.php) |
103103
| `DELETE /{realm}/users/{id}/role-mappings/realm` | `n/a` | [Users::removeRealmRoles()](src/Resource/Users.php) |
104104

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

113-
### [Root](https://www.keycloak.org/docs-api/21.0.0/rest-api/index.html#_root_resource)
113+
### [Root](https://www.keycloak.org/docs-api/22.0.0/rest-api/index.html#_root_resource)
114114
| Endpoint | Response | API |
115115
|----------|----------|-----|
116116
| `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:21.0.0
13+
image: quay.io/keycloak/keycloak:22.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=21.0.0
1+
ARG KEYCLOAK_VERSION=22.0.0
22
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION}
33

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

src/Collection/AuthenticationExecutionExportCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\AuthenticationExecutionExport;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<AuthenticationExecutionExport>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class AuthenticationExecutionExportCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/AuthenticationFlowCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\AuthenticationFlow;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<AuthenticationFlow>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class AuthenticationFlowCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/AuthenticatorConfigCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\AuthenticatorConfig;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<AuthenticatorConfig>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class AuthenticatorConfigCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ClientCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Client;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Client>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ClientCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ClientPolicyCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\ClientPolicy;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<ClientPolicy>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ClientPolicyCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ClientPolicyExecutorCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\ClientPolicyExecutor;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<ClientPolicyExecutor>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ClientPolicyExecutorCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ClientProfileCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\ClientProfile;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<ClientProfile>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ClientProfileCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ClientScopeCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\ClientScope;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<ClientScope>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ClientScopeCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/CredentialCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Credential;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Credential>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class CredentialCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/FederatedIdentityCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\FederatedIdentity;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<FederatedIdentity>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class FederatedIdentityCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/GroupCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Group;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Group>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class GroupCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/IdentityProviderCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\IdentityProvider;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<IdentityProvider>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class IdentityProviderCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/IdentityProviderMapperCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\IdentityProviderMapper;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<IdentityProviderMapper>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class IdentityProviderMapperCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/PasswordPolicyTypeCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\PasswordPolicyType;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<PasswordPolicyType>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class PasswordPolicyTypeCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/PolicyCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Policy;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Policy>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class PolicyCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ProtocolMapperCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\ProtocolMapper;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<ProtocolMapper>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ProtocolMapperCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/RealmCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Realm;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Realm>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class RealmCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/RequiredActionProviderCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\RequiredActionProvider;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<RequiredActionProvider>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class RequiredActionProviderCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ResourceCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Resource;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Resource>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ResourceCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/RoleCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Role;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Role>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class RoleCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

src/Collection/ScopeCollection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace Fschmtt\Keycloak\Collection;
66

77
use Fschmtt\Keycloak\Representation\Scope;
8+
use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage;
89

910
/**
10-
* @codeCoverageIgnore
1111
* @extends Collection<Scope>
1212
*/
13+
#[IgnoreClassForCodeCoverage(self::class)]
1314
class ScopeCollection extends Collection
1415
{
1516
public static function getRepresentationClass(): string

0 commit comments

Comments
 (0)