Browse Source

Added create_client_scope

master
ggallard 4 years ago
parent
commit
7f0ed66803
  1. 16
      keycloak/keycloak_admin.py

16
keycloak/keycloak_admin.py

@ -1252,6 +1252,22 @@ class KeycloakAdmin:
data_raw = self.raw_get(URL_ADMIN_CLIENT_SCOPE.format(**params_path))
return raise_error_from_response(data_raw, KeycloakGetError)
def create_client_scope(self, payload, skip_exists=False):
"""
Create a client scope
ClientScopeRepresentation: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getclientscopes
:param payload: ClientScopeRepresentation
:param skip_exists: If true then do not raise an error if client scope already exists
:return: Keycloak server response (ClientScopeRepresentation)
"""
params_path = {"realm-name": self.realm_name}
data_raw = self.raw_post(URL_ADMIN_CLIENT_SCOPES.format(**params_path),
data=json.dumps(payload))
return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201, skip_exists=skip_exists)
def add_mapper_to_client_scope(self, client_scope_id, payload):
"""
Add a mapper to a client scope

Loading…
Cancel
Save