|
|
@ -1424,6 +1424,8 @@ class KeycloakOpenID: |
|
|
|
params_path = {"realm-name": self.realm_name} |
|
|
|
orig_bearer = self.connection.headers.get("Authorization") |
|
|
|
self.connection.add_param_headers("Authorization", "Bearer " + token) |
|
|
|
orig_content_type = self.connection.headers.get("Content-Type") |
|
|
|
self.connection.add_param_headers("Content-Type", "application/json") |
|
|
|
data_raw = await self.connection.a_raw_post( |
|
|
|
URL_CLIENT_REGISTRATION.format(**params_path), data=json.dumps(payload) |
|
|
|
) |
|
|
@ -1432,6 +1434,11 @@ class KeycloakOpenID: |
|
|
|
if orig_bearer is not None |
|
|
|
else self.connection.del_param_headers("Authorization") |
|
|
|
) |
|
|
|
( |
|
|
|
self.connection.add_param_headers("Content-Type", orig_content_type) |
|
|
|
if orig_content_type is not None |
|
|
|
else self.connection.del_param_headers("Content-Type") |
|
|
|
) |
|
|
|
return raise_error_from_response(data_raw, KeycloakPostError) |
|
|
|
|
|
|
|
async def a_device(self): |
|
|
@ -1477,6 +1484,8 @@ class KeycloakOpenID: |
|
|
|
params_path = {"realm-name": self.realm_name, "client-id": client_id} |
|
|
|
orig_bearer = self.connection.headers.get("Authorization") |
|
|
|
self.connection.add_param_headers("Authorization", "Bearer " + token) |
|
|
|
orig_content_type = self.connection.headers.get("Content-Type") |
|
|
|
self.connection.add_param_headers("Content-Type", "application/json") |
|
|
|
|
|
|
|
# Keycloak complains if the clientId is not set in the payload |
|
|
|
if "clientId" not in payload: |
|
|
@ -1490,4 +1499,9 @@ class KeycloakOpenID: |
|
|
|
if orig_bearer is not None |
|
|
|
else self.connection.del_param_headers("Authorization") |
|
|
|
) |
|
|
|
( |
|
|
|
self.connection.add_param_headers("Content-Type", orig_content_type) |
|
|
|
if orig_content_type is not None |
|
|
|
else self.connection.del_param_headers("Content-Type") |
|
|
|
) |
|
|
|
return raise_error_from_response(data_raw, KeycloakPutError) |