diff --git a/src/keycloak/keycloak_admin.py b/src/keycloak/keycloak_admin.py index fba28c2..c9712e0 100644 --- a/src/keycloak/keycloak_admin.py +++ b/src/keycloak/keycloak_admin.py @@ -2343,6 +2343,23 @@ class KeycloakAdmin: ) return raise_error_from_response(data_raw, KeycloakPutError, expected_codes=[204]) + def get_mappers_from_client(self, client_id): + """ + List of all client mappers. + + https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_protocolmapperrepresentation + + :param client_id: Client id + :returns: KeycloakServerResponse (list of ProtocolMapperRepresentation) + """ + params_path = {"realm-name": self.realm_name, "id": client_id} + + data_raw = self.raw_get( + urls_patterns.URL_ADMIN_CLIENT_PROTOCOL_MAPPERS.format(**params_path) + ) + + return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[200]) + def add_mapper_to_client(self, client_id, payload): """ Add a mapper to a client @@ -2373,7 +2390,7 @@ class KeycloakAdmin: params_path = { "realm-name": self.realm_name, - "id": self.client_id, + "id": client_id, "protocol-mapper-id": mapper_id, }