From 9cb91ca8b75377f49321e0b4e0854807cb8dc753 Mon Sep 17 00:00:00 2001 From: Michael Rosenberger Date: Wed, 7 Sep 2022 16:36:40 +0200 Subject: [PATCH] Add functions for socialLoginProviders --- README.md | 6 +-- src/Admin/KeycloakClient.php | 4 ++ src/Admin/Resources/keycloak-1_0.php | 70 +++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e2bf3e7..f95200c 100644 --- a/README.md +++ b/README.md @@ -588,9 +588,9 @@ Note: Ids are sent as clientScopeId or clientId and mapperId everything else is | 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 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 | ✔️ | diff --git a/src/Admin/KeycloakClient.php b/src/Admin/KeycloakClient.php index b15d56b..58ec556 100644 --- a/src/Admin/KeycloakClient.php +++ b/src/Admin/KeycloakClient.php @@ -274,6 +274,10 @@ * * @method array syncUserStorage(array $args = array()) { @command Keycloak syncUserStorage } * + * @method array getSocialLogins(array $args = array()) { @command Keycloak getSocialLogins } + * @method array addSocialLogin(array $args = array()) { @command Keycloak getSocialLogins } + * @method array removeSocialLogin(array $args = array()) { @command Keycloak getSocialLogins } + * */ class KeycloakClient extends GuzzleClient diff --git a/src/Admin/Resources/keycloak-1_0.php b/src/Admin/Resources/keycloak-1_0.php index f5b4d56..d02221a 100644 --- a/src/Admin/Resources/keycloak-1_0.php +++ b/src/Admin/Resources/keycloak-1_0.php @@ -5449,6 +5449,74 @@ ) ) ), - + 'getSocialLogins' => array( + 'uri' => 'admin/realms/{realm}/users/{id}/federated-identity', + 'description' => 'Get social logins 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, + ), + ) + ), + 'removeSocialLogin' => array( + 'uri' => 'admin/realms/{realm}/users/{id}/federated-identity/{providerId}', + 'description' => 'Remove social login associated with the user', + 'httpMethod' => 'DELETE', + '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, + ), + 'providerId' => array( + 'location' => 'uri', + 'description' => 'The Provider ID', + 'type' => 'string', + 'required' => true, + ), + ) + ), + 'addSocialLogin' => array( + 'uri' => 'admin/realms/{realm}/users/{id}/federated-identity/{providerId}', + 'description' => 'Add social login associated with the user', + 'httpMethod' => 'POST', + '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, + ), + 'providerId' => array( + 'location' => 'uri', + 'description' => 'The Provider ID', + 'type' => 'string', + 'required' => true, + ), + ) + $FederatedIdentityRepresentation, + ), ) //End of Operations Array );//End of return array