From 521f4863211c0b8243550f257c4ce071b51fe6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Farr=C3=A9?= <23310825+funkycram@users.noreply.github.com> Date: Tue, 15 Mar 2022 11:28:38 +0100 Subject: [PATCH 1/5] Update KeycloakClient.php Removed duplicated `* @method array getClientProtocolMappers(array $args = array()) { @command Keycloak getClientProtocolMappers }` --- src/Admin/KeycloakClient.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Admin/KeycloakClient.php b/src/Admin/KeycloakClient.php index 4f48ea6..282131d 100644 --- a/src/Admin/KeycloakClient.php +++ b/src/Admin/KeycloakClient.php @@ -162,7 +162,6 @@ * @method array getClientScopeProtocolMappersByProtocolName(array $args = array()) { @command Keycloak getClientScopeProtocolMappersByProtocolName } * @method array createClientProtocolMappers(array $args = array()) { @command Keycloak createClientProtocolMappers } * @method array createClientProtocolMapper(array $args = array()) { @command Keycloak createClientProtocolMapper } - * @method array getClientProtocolMappers(array $args = array()) { @command Keycloak getClientProtocolMappers } * @method array getClientProtocolMapperById(array $args = array()) { @command Keycloak getClientProtocolMapperById } * @method array updateClientProtocolMapper(array $args = array()) { @command Keycloak updateClientProtocolMapper } * @method array deleteClientProtocolMapper(array $args = array()) { @command Keycloak deleteClientProtocolMapper } From 572b2e8c94b2dec2cf93f0d9007045ee2b1a7566 Mon Sep 17 00:00:00 2001 From: funkycram Date: Thu, 12 May 2022 16:13:09 +0200 Subject: [PATCH 2/5] Add getUserSessions method --- README.md | 50 ++++++++++++++-------------- src/Admin/KeycloakClient.php | 1 + src/Admin/Resources/keycloak-1_0.php | 20 +++++++++++ 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b409a53..084e707 100644 --- a/README.md +++ b/README.md @@ -575,33 +575,33 @@ Note: Ids are sent as clientScopeId or clientId and mapperId everything else is ## [Users]() -| API | Function Name | Supported | -|-----|:-------------:|:---------:| -| Create a new user Username must be unique. | createUser | ✔️ | -| Get users Returns a list of users, filtered according to query parameters | getUsers | ✔️ | -| GET /{realm}/users/count | getUserCount | ✔️ | -| Get representation of the user | getUser | ️️️✔️ | -| Update the user | updateUser | ️️️✔️ | -| Update partial data for the user | updatePartialUser | ️️️✔️ | -| Delete the user | deleteUser | ️️️✔️ | -| Get consents granted by the user | | ❌ | -| Revoke consent and offline tokens for particular client from user | | ❌ | -| Disable all credentials for a user of a specific type | | ❌ | +| API | Function Name | Supported | +|-----|:-------------------:|:---------:| +| Create a new user Username must be unique. | createUser | ✔️ | +| Get users Returns a list of users, filtered according to query parameters | getUsers | ✔️ | +| GET /{realm}/users/count | getUserCount | ✔️ | +| Get representation of the user | getUser | ️️️✔️ | +| Update the user | updateUser | ️️️✔️ | +| Update partial data for the user | updatePartialUser | ️️️✔️ | +| Delete the user | deleteUser | ️️️✔️ | +| Get consents granted by the user | | ❌ | +| Revoke consent and offline tokens for particular client from user | | ❌ | +| Disable all credentials for a user of a specific type | | ❌ | | Send a update account email to the user An email contains a link the user can click to perform a set of required actions. | executeActionsEmail | ✔️ | -| Get social logins associated with the user | | ❌ | -| Add a social login provider to the user | | ❌ | -| Remove a social login provider from user | | ❌ | -| GET /{realm}/users/{id}/groups | getUserGroups | ✔️ | -| GET /{realm}/users/{id}/groups/count | getUserGroupsCount | ✔️ | -| PUT /{realm}/users/{id}/groups/{groupId} | addUserToGroup | ✔️ | +| Get social logins associated with the user | | ❌ | +| Add a social login provider to the user | | ❌ | +| Remove a social login provider from user | | ❌ | +| GET /{realm}/users/{id}/groups | getUserGroups | ✔️ | +| GET /{realm}/users/{id}/groups/count | getUserGroupsCount | ✔️ | +| PUT /{realm}/users/{id}/groups/{groupId} | addUserToGroup | ✔️ | | DELETE /{realm}/users/{id}/groups/{groupId} | deleteUserFromGroup | ✔️ | -| Impersonate the user | | ❌ | -| Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. | | ❌ | -| Get offline sessions associated with the user and client | | ❌ | -| Remove TOTP from the user | | ❌ | -| Set up a new password for the user. | resetUserPassword | ✔️ | -| Send an email-verification email to the user An email contains a link the user can click to verify their email address. | sendVerifyEmail | ✔️ | -| Get sessions associated with the user | | ❌ | +| Impersonate the user | | ❌ | +| Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. | | ❌ | +| Get offline sessions associated with the user and client | | ❌ | +| Remove TOTP from the user | | ❌ | +| Set up a new password for the user. | resetUserPassword | ✔️ | +| Send an email-verification email to the user An email contains a link the user can click to verify their email address. | sendVerifyEmail | ✔️ | +| Get sessions associated with the user | getUserSessions | ✔ | ## [Root]() diff --git a/src/Admin/KeycloakClient.php b/src/Admin/KeycloakClient.php index 4f48ea6..a6a3b90 100644 --- a/src/Admin/KeycloakClient.php +++ b/src/Admin/KeycloakClient.php @@ -271,6 +271,7 @@ * @method array addUserToGroup(array $args = array()) { @command Keycloak addUserToGroup } * @method array deleteUserFromGroup(array $args = array()) { @command Keycloak deleteUserFromGroup } * @method array resetUserPassword(array $args = array()) { @command Keycloak resetUserPassword } + * @method array getUserSessions(array $args = array()) { @command Keycloak resetUserPassword } * * @method array syncUserStorage(array $args = array()) { @command Keycloak syncUserStorage } * diff --git a/src/Admin/Resources/keycloak-1_0.php b/src/Admin/Resources/keycloak-1_0.php index 3fe7950..a0271f4 100644 --- a/src/Admin/Resources/keycloak-1_0.php +++ b/src/Admin/Resources/keycloak-1_0.php @@ -5326,6 +5326,26 @@ ), ), + 'getUserSessions' => array( + 'uri' => 'admin/realms/{realm}/users/{id}/sessions', + 'description' => 'Get sessions associated with the user', + 'httpMethod' => 'GET', + 'parameters' => array( + 'realm' => array( + 'location' => 'uri', + 'description' => 'The Realm name', + 'type' => 'string', + 'required' => true, + ), + 'id' => array( + 'location' => 'uri', + 'description' => 'User id', + 'type' => 'string', + 'required' => true + ) + ) + ), + 'addUserToGroup' => array( 'uri' => 'admin/realms/{realm}/users/{id}/groups/{groupId}', 'description' => 'Assign a specific user to a specific group', From feb92f537728da2ddac3a047e3614a91e8df82cd Mon Sep 17 00:00:00 2001 From: funkycram Date: Thu, 12 May 2022 16:14:28 +0200 Subject: [PATCH 3/5] Add getUserSessions method --- README.md | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 084e707..e2bf3e7 100644 --- a/README.md +++ b/README.md @@ -575,33 +575,33 @@ Note: Ids are sent as clientScopeId or clientId and mapperId everything else is ## [Users]() -| API | Function Name | Supported | -|-----|:-------------------:|:---------:| -| Create a new user Username must be unique. | createUser | ✔️ | -| Get users Returns a list of users, filtered according to query parameters | getUsers | ✔️ | -| GET /{realm}/users/count | getUserCount | ✔️ | -| Get representation of the user | getUser | ️️️✔️ | -| Update the user | updateUser | ️️️✔️ | -| Update partial data for the user | updatePartialUser | ️️️✔️ | -| Delete the user | deleteUser | ️️️✔️ | -| Get consents granted by the user | | ❌ | -| Revoke consent and offline tokens for particular client from user | | ❌ | -| Disable all credentials for a user of a specific type | | ❌ | +| API | Function Name | Supported | +|-----|:-------------:|:---------:| +| Create a new user Username must be unique. | createUser | ✔️ | +| Get users Returns a list of users, filtered according to query parameters | getUsers | ✔️ | +| GET /{realm}/users/count | getUserCount | ✔️ | +| Get representation of the user | getUser | ️️️✔️ | +| Update the user | updateUser | ️️️✔️ | +| Update partial data for the user | updatePartialUser | ️️️✔️ | +| Delete the user | deleteUser | ️️️✔️ | +| Get consents granted by the user | | ❌ | +| Revoke consent and offline tokens for particular client from user | | ❌ | +| Disable all credentials for a user of a specific type | | ❌ | | Send a update account email to the user An email contains a link the user can click to perform a set of required actions. | executeActionsEmail | ✔️ | -| Get social logins associated with the user | | ❌ | -| Add a social login provider to the user | | ❌ | -| Remove a social login provider from user | | ❌ | -| GET /{realm}/users/{id}/groups | getUserGroups | ✔️ | -| GET /{realm}/users/{id}/groups/count | getUserGroupsCount | ✔️ | -| PUT /{realm}/users/{id}/groups/{groupId} | addUserToGroup | ✔️ | +| Get social logins associated with the user | | ❌ | +| Add a social login provider to the user | | ❌ | +| Remove a social login provider from user | | ❌ | +| GET /{realm}/users/{id}/groups | getUserGroups | ✔️ | +| GET /{realm}/users/{id}/groups/count | getUserGroupsCount | ✔️ | +| PUT /{realm}/users/{id}/groups/{groupId} | addUserToGroup | ✔️ | | DELETE /{realm}/users/{id}/groups/{groupId} | deleteUserFromGroup | ✔️ | -| Impersonate the user | | ❌ | -| Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. | | ❌ | -| Get offline sessions associated with the user and client | | ❌ | -| Remove TOTP from the user | | ❌ | -| Set up a new password for the user. | resetUserPassword | ✔️ | -| Send an email-verification email to the user An email contains a link the user can click to verify their email address. | sendVerifyEmail | ✔️ | -| Get sessions associated with the user | getUserSessions | ✔ | +| Impersonate the user | | ❌ | +| Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. | | ❌ | +| Get offline sessions associated with the user and client | | ❌ | +| Remove TOTP from the user | | ❌ | +| Set up a new password for the user. | resetUserPassword | ✔️ | +| Send an email-verification email to the user An email contains a link the user can click to verify their email address. | sendVerifyEmail | ✔️ | +| Get sessions associated with the user | getUserSessions | ✔ | ## [Root]() From 3f7492169cec8a63ead573ad3de71598b16ed3c8 Mon Sep 17 00:00:00 2001 From: funkycram Date: Sun, 15 May 2022 10:19:52 +0200 Subject: [PATCH 4/5] Add getUserSessions method --- src/Admin/KeycloakClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/KeycloakClient.php b/src/Admin/KeycloakClient.php index a6a3b90..043e9b4 100644 --- a/src/Admin/KeycloakClient.php +++ b/src/Admin/KeycloakClient.php @@ -271,7 +271,7 @@ * @method array addUserToGroup(array $args = array()) { @command Keycloak addUserToGroup } * @method array deleteUserFromGroup(array $args = array()) { @command Keycloak deleteUserFromGroup } * @method array resetUserPassword(array $args = array()) { @command Keycloak resetUserPassword } - * @method array getUserSessions(array $args = array()) { @command Keycloak resetUserPassword } + * @method array getUserSessions(array $args = array()) { @command Keycloak getUserSessions } * * @method array syncUserStorage(array $args = array()) { @command Keycloak syncUserStorage } * From 348bda93930bc17fe41a2d97be6a4c0936b4ca51 Mon Sep 17 00:00:00 2001 From: dobro_lubov Date: Mon, 23 May 2022 14:38:10 +0300 Subject: [PATCH 5/5] Add q parameter to getUsers method --- src/Admin/Resources/keycloak-1_0.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Admin/Resources/keycloak-1_0.php b/src/Admin/Resources/keycloak-1_0.php index 3fe7950..638d9b0 100644 --- a/src/Admin/Resources/keycloak-1_0.php +++ b/src/Admin/Resources/keycloak-1_0.php @@ -5128,6 +5128,12 @@ 'type' => 'string', 'required' => false, ), + 'q' => array( + 'location' => 'query', + 'description' => 'A query to search for custom attributes, in the format \'key1:value2 key2:value2\'', + 'type' => 'string', + 'required' => false, + ), ), ),