Browse Source

Merge pull request #29 from ableuler/master

Add method to update clients
hotfix/merge
Marcos Pereira 5 years ago
committed by GitHub
parent
commit
d43b54a009
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      keycloak/keycloak_admin.py

18
keycloak/keycloak_admin.py

@ -179,13 +179,13 @@ class KeycloakAdmin:
def create_realm(self, payload, skip_exists=False): def create_realm(self, payload, skip_exists=False):
""" """
Create a client
Create a realm
ClientRepresentation: http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_realmrepresentation ClientRepresentation: http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_realmrepresentation
:param skip_exists: Skip if Realm already exist. :param skip_exists: Skip if Realm already exist.
:param payload: RealmRepresentation :param payload: RealmRepresentation
:return: Keycloak server response (UserRepresentation)
:return: Keycloak server response (RealmRepresentation)
""" """
data_raw = self.connection.raw_post(URL_ADMIN_REALMS, data_raw = self.connection.raw_post(URL_ADMIN_REALMS,
@ -685,6 +685,20 @@ class KeycloakAdmin:
data=json.dumps(payload)) data=json.dumps(payload))
return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201, skip_exists=skip_exists) return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201, skip_exists=skip_exists)
def update_client(self, client_id, payload):
"""
Update a client
:param client_id: Client id
:param payload: ClientRepresentation
:return: Http response
"""
params_path = {"realm-name": self.realm_name, "id": client_id}
data_raw = self.connection.raw_put(URL_ADMIN_CLIENT.format(**params_path),
data=json.dumps(payload))
return raise_error_from_response(data_raw, KeycloakGetError, expected_code=204)
def delete_client(self, client_id): def delete_client(self, client_id):
""" """
Get representation of the client Get representation of the client

Loading…
Cancel
Save