|
@ -606,7 +606,6 @@ class KeycloakAdmin: |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
|
|
|
|
|
|
def add_user_social_login(self, user_id, provider_id, provider_userid, provider_username): |
|
|
def add_user_social_login(self, user_id, provider_id, provider_userid, provider_username): |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
Add a federated identity / social login provider to the user |
|
|
Add a federated identity / social login provider to the user |
|
|
:param user_id: User id |
|
|
:param user_id: User id |
|
@ -617,10 +616,9 @@ class KeycloakAdmin: |
|
|
""" |
|
|
""" |
|
|
payload = {"identityProvider": provider_id, "userId": provider_userid, "userName": provider_username} |
|
|
payload = {"identityProvider": provider_id, "userId": provider_userid, "userName": provider_username} |
|
|
params_path = {"realm-name": self.realm_name, "id": user_id, "provider": provider_id} |
|
|
params_path = {"realm-name": self.realm_name, "id": user_id, "provider": provider_id} |
|
|
data_raw = self.raw_post(URL_ADMIN_USER_FEDERATED_IDENTITY.format(**params_path), data=json.dumps(payload)) |
|
|
|
|
|
|
|
|
self.raw_post(URL_ADMIN_USER_FEDERATED_IDENTITY.format(**params_path), data=json.dumps(payload)) |
|
|
|
|
|
|
|
|
def delete_user_social_login(self, user_id, provider_id): |
|
|
def delete_user_social_login(self, user_id, provider_id): |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
Delete a federated identity / social login provider from the user |
|
|
Delete a federated identity / social login provider from the user |
|
|
:param user_id: User id |
|
|
:param user_id: User id |
|
@ -794,7 +792,7 @@ class KeycloakAdmin: |
|
|
if group['path'] == path: |
|
|
if group['path'] == path: |
|
|
return group |
|
|
return group |
|
|
res = self.get_subgroups(group, path) |
|
|
res = self.get_subgroups(group, path) |
|
|
if res != None: |
|
|
|
|
|
|
|
|
if res is not None: |
|
|
return res |
|
|
return res |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
@ -1311,7 +1309,6 @@ class KeycloakAdmin: |
|
|
params_path = {"realm-name": self.realm_name, "id": client_id, "role-name": role_name} |
|
|
params_path = {"realm-name": self.realm_name, "id": client_id, "role-name": role_name} |
|
|
return self.__fetch_all(URL_ADMIN_CLIENT_ROLE_MEMBERS.format(**params_path), query) |
|
|
return self.__fetch_all(URL_ADMIN_CLIENT_ROLE_MEMBERS.format(**params_path), query) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_realm_role(self, payload, skip_exists=False): |
|
|
def create_realm_role(self, payload, skip_exists=False): |
|
|
""" |
|
|
""" |
|
|
Create a new role for the realm or client |
|
|
Create a new role for the realm or client |
|
@ -1951,7 +1948,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_get(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPES.format(**params_path)) |
|
|
data_raw = self.raw_get(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPES.format(**params_path)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_default_default_client_scope(self, scope_id): |
|
|
def delete_default_default_client_scope(self, scope_id): |
|
|
""" |
|
|
""" |
|
|
Delete default default client scope |
|
|
Delete default default client scope |
|
@ -1963,7 +1959,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_delete(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path)) |
|
|
data_raw = self.raw_delete(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_default_default_client_scope(self, scope_id): |
|
|
def add_default_default_client_scope(self, scope_id): |
|
|
""" |
|
|
""" |
|
|
Add default default client scope |
|
|
Add default default client scope |
|
@ -1976,7 +1971,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_put(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload)) |
|
|
data_raw = self.raw_put(URL_ADMIN_DEFAULT_DEFAULT_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_default_optional_client_scopes(self): |
|
|
def get_default_optional_client_scopes(self): |
|
|
""" |
|
|
""" |
|
|
Return list of default optional client scopes |
|
|
Return list of default optional client scopes |
|
@ -1987,7 +1981,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_get(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPES.format(**params_path)) |
|
|
data_raw = self.raw_get(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPES.format(**params_path)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_default_optional_client_scope(self, scope_id): |
|
|
def delete_default_optional_client_scope(self, scope_id): |
|
|
""" |
|
|
""" |
|
|
Delete default optional client scope |
|
|
Delete default optional client scope |
|
@ -1999,7 +1992,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_delete(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path)) |
|
|
data_raw = self.raw_delete(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_default_optional_client_scope(self, scope_id): |
|
|
def add_default_optional_client_scope(self, scope_id): |
|
|
""" |
|
|
""" |
|
|
Add default optional client scope |
|
|
Add default optional client scope |
|
@ -2012,7 +2004,6 @@ class KeycloakAdmin: |
|
|
data_raw = self.raw_put(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload)) |
|
|
data_raw = self.raw_put(URL_ADMIN_DEFAULT_OPTIONAL_CLIENT_SCOPE.format(**params_path), data=json.dumps(payload)) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_mapper_to_client(self, client_id, payload): |
|
|
def add_mapper_to_client(self, client_id, payload): |
|
|
""" |
|
|
""" |
|
|
Add a mapper to a client |
|
|
Add a mapper to a client |
|
@ -2364,4 +2355,3 @@ class KeycloakAdmin: |
|
|
self.URL_ADMIN_CLIENT_SESSION_STATS.format(**params_path) |
|
|
self.URL_ADMIN_CLIENT_SESSION_STATS.format(**params_path) |
|
|
) |
|
|
) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
return raise_error_from_response(data_raw, KeycloakGetError) |
|
|
|
|
|
|