|
@ -3633,26 +3633,27 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
|
def update_authentication_flow(self, flow_id: str, payload: dict) -> bytes: |
|
|
def update_authentication_flow(self, flow_id: str, payload: dict) -> bytes: |
|
|
""" |
|
|
""" |
|
|
Update exits authentication flow. |
|
|
|
|
|
|
|
|
Update an authentication flow. |
|
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
AuthenticationFlowRepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
|
:param id |
|
|
|
|
|
:type id: str |
|
|
|
|
|
|
|
|
:param flow_id: The id of the flow |
|
|
|
|
|
:type flow_id: str |
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
:type payload: dict |
|
|
:type payload: dict |
|
|
:param skip_exists: Do not raise an error if authentication flow already exists |
|
|
|
|
|
:type skip_exists: bool |
|
|
|
|
|
:return: Keycloak server response (RoleRepresentation) |
|
|
|
|
|
|
|
|
:return: Keycloak server response |
|
|
:rtype: bytes |
|
|
:rtype: bytes |
|
|
""" |
|
|
""" |
|
|
params_path = {"id": flow_id, "realm-name": self.connection.realm_name} |
|
|
params_path = {"id": flow_id, "realm-name": self.connection.realm_name} |
|
|
data_raw = self.connection.raw_put( |
|
|
data_raw = self.connection.raw_put( |
|
|
urls_patterns.URL_ADMIN_FLOW.format(**params_path), data=json.dumps(payload), |
|
|
|
|
|
|
|
|
urls_patterns.URL_ADMIN_FLOW.format(**params_path), |
|
|
|
|
|
data=json.dumps(payload), |
|
|
) |
|
|
) |
|
|
return raise_error_from_response( |
|
|
return raise_error_from_response( |
|
|
data_raw, KeycloakPutError, expected_codes=[HTTP_ACCEPTED, HTTP_NO_CONTENT], |
|
|
|
|
|
|
|
|
data_raw, |
|
|
|
|
|
KeycloakPutError, |
|
|
|
|
|
expected_codes=[HTTP_ACCEPTED, HTTP_NO_CONTENT], |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def copy_authentication_flow(self, payload: dict, flow_alias: str) -> bytes: |
|
|
def copy_authentication_flow(self, payload: dict, flow_alias: str) -> bytes: |
|
@ -3810,9 +3811,10 @@ class KeycloakAdmin: |
|
|
""" |
|
|
""" |
|
|
Raise or lower execution priority of diff time. |
|
|
Raise or lower execution priority of diff time. |
|
|
|
|
|
|
|
|
:param execution_id: id of execution to lower priority |
|
|
|
|
|
|
|
|
:param execution_id: The ID of the execution |
|
|
:type execution_id: str |
|
|
:type execution_id: str |
|
|
:param diff: Integer number, raise of diff time if positive lower of diff time if negative |
|
|
|
|
|
|
|
|
:param diff: The difference in priority, positive to raise, negative to lower, the value |
|
|
|
|
|
is the number of times |
|
|
:type diff: int |
|
|
:type diff: int |
|
|
:raises KeycloakPostError: when post requests are failed |
|
|
:raises KeycloakPostError: when post requests are failed |
|
|
""" |
|
|
""" |
|
@ -3927,14 +3929,14 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
|
def create_execution_config(self, execution_id: str, payload: dict) -> bytes: |
|
|
def create_execution_config(self, execution_id: str, payload: dict) -> bytes: |
|
|
""" |
|
|
""" |
|
|
Add autenticatorConfig to the execution. |
|
|
|
|
|
|
|
|
Update execution with new configuration. |
|
|
|
|
|
|
|
|
AuthenticatorConfigRepresentation |
|
|
AuthenticatorConfigRepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
|
|
|
|
|
|
:param execution_id: id of execution |
|
|
|
|
|
|
|
|
:param execution_id: The ID of the execution |
|
|
:type execution_id: str |
|
|
:type execution_id: str |
|
|
:param payload: config to add to the execution |
|
|
|
|
|
|
|
|
:param payload: Configuration to add to the execution |
|
|
:type payload: dir |
|
|
:type payload: dir |
|
|
:return: Response(json) |
|
|
:return: Response(json) |
|
|
:rtype: dict |
|
|
:rtype: dict |
|
@ -3948,7 +3950,7 @@ class KeycloakAdmin: |
|
|
data_raw, |
|
|
data_raw, |
|
|
KeycloakPostError, |
|
|
KeycloakPostError, |
|
|
expected_codes=[HTTP_CREATED], |
|
|
expected_codes=[HTTP_CREATED], |
|
|
) |
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
def update_authenticator_config(self, payload: dict, config_id: str) -> bytes: |
|
|
def update_authenticator_config(self, payload: dict, config_id: str) -> bytes: |
|
|
""" |
|
|
""" |
|
@ -10582,18 +10584,19 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
|
async def a_change_execution_priority(self, execution_id: str, diff: int) -> None: |
|
|
async def a_change_execution_priority(self, execution_id: str, diff: int) -> None: |
|
|
""" |
|
|
""" |
|
|
Raise or lower execution priority of diff time asynchronously. |
|
|
|
|
|
|
|
|
Raise or lower execution priority of diff time. |
|
|
|
|
|
|
|
|
:param execution_id: id of execution to lower priority |
|
|
|
|
|
|
|
|
:param execution_id: The ID of the execution |
|
|
:type execution_id: str |
|
|
:type execution_id: str |
|
|
:param diff: Integer number, raise of diff time if positive lower of diff time if negative |
|
|
|
|
|
|
|
|
:param diff: The difference in priority, positive to raise, negative to lower, the value |
|
|
|
|
|
is the number of times |
|
|
:type diff: int |
|
|
:type diff: int |
|
|
:raises KeycloakPostError: when post requests are failed |
|
|
:raises KeycloakPostError: when post requests are failed |
|
|
""" |
|
|
""" |
|
|
params_path = {"id": execution_id, "realm-name": self.connection.realm_name} |
|
|
params_path = {"id": execution_id, "realm-name": self.connection.realm_name} |
|
|
if diff > 0: |
|
|
if diff > 0: |
|
|
for _ in range(diff): |
|
|
for _ in range(diff): |
|
|
data_raw = self.connection.a_raw_post( |
|
|
|
|
|
|
|
|
data_raw = await self.connection.a_raw_post( |
|
|
urls_patterns.URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY.format( |
|
|
urls_patterns.URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY.format( |
|
|
**params_path, |
|
|
**params_path, |
|
|
), |
|
|
), |
|
@ -10606,7 +10609,7 @@ class KeycloakAdmin: |
|
|
) |
|
|
) |
|
|
elif diff < 0: |
|
|
elif diff < 0: |
|
|
for _ in range(-diff): |
|
|
for _ in range(-diff): |
|
|
data_raw = self.connection.a_raw_post( |
|
|
|
|
|
|
|
|
data_raw = await self.connection.a_raw_post( |
|
|
urls_patterns.URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY.format( |
|
|
urls_patterns.URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY.format( |
|
|
**params_path, |
|
|
**params_path, |
|
|
), |
|
|
), |
|
@ -10620,20 +10623,20 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
|
async def a_create_execution_config(self, execution_id: str, payload: dict) -> bytes: |
|
|
async def a_create_execution_config(self, execution_id: str, payload: dict) -> bytes: |
|
|
""" |
|
|
""" |
|
|
Add autenticatorConfig to the execution. |
|
|
|
|
|
|
|
|
Update execution with new configuration. |
|
|
|
|
|
|
|
|
AuthenticatorConfigRepresentation |
|
|
AuthenticatorConfigRepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
|
|
|
|
|
|
:param execution_id: id of execution |
|
|
|
|
|
|
|
|
:param execution_id: The ID of the execution |
|
|
:type execution_id: str |
|
|
:type execution_id: str |
|
|
:param payload: config to add to the execution |
|
|
|
|
|
|
|
|
:param payload: Configuration to add to the execution |
|
|
:type payload: dir |
|
|
:type payload: dir |
|
|
:return: Response(json) |
|
|
:return: Response(json) |
|
|
:rtype: dict |
|
|
:rtype: dict |
|
|
""" |
|
|
""" |
|
|
params_path = {"id": execution_id, "realm-name": self.connection.realm_name} |
|
|
params_path = {"id": execution_id, "realm-name": self.connection.realm_name} |
|
|
data_raw = self.connection.a_raw_post( |
|
|
|
|
|
|
|
|
data_raw = await self.connection.a_raw_post( |
|
|
urls_patterns.URL_ADMIN_FLOWS_EXECUTION_CONFIG.format(**params_path), |
|
|
urls_patterns.URL_ADMIN_FLOWS_EXECUTION_CONFIG.format(**params_path), |
|
|
data=json.dumps(payload), |
|
|
data=json.dumps(payload), |
|
|
) |
|
|
) |
|
@ -10645,24 +10648,25 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
|
async def a_update_authentication_flow(self, flow_id: str, payload: dict) -> bytes: |
|
|
async def a_update_authentication_flow(self, flow_id: str, payload: dict) -> bytes: |
|
|
""" |
|
|
""" |
|
|
Update exits authentication flow. |
|
|
|
|
|
|
|
|
Update an authentication flow. |
|
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
AuthenticationFlowRepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation |
|
|
https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
|
:param id |
|
|
|
|
|
:type id: str |
|
|
|
|
|
|
|
|
:param flow_id: The id of the flow |
|
|
|
|
|
:type flow_id: str |
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
:type payload: dict |
|
|
:type payload: dict |
|
|
:param skip_exists: Do not raise an error if authentication flow already exists |
|
|
|
|
|
:type skip_exists: bool |
|
|
|
|
|
:return: Keycloak server response (RoleRepresentation) |
|
|
|
|
|
|
|
|
:return: Keycloak server response |
|
|
:rtype: bytes |
|
|
:rtype: bytes |
|
|
""" |
|
|
""" |
|
|
params_path = {"id": flow_id, "realm-name": self.connection.realm_name} |
|
|
params_path = {"id": flow_id, "realm-name": self.connection.realm_name} |
|
|
data_raw = self.connection.a_raw_put( |
|
|
|
|
|
urls_patterns.URL_ADMIN_FLOW.format(**params_path), data=json.dumps(payload), |
|
|
|
|
|
|
|
|
data_raw = await self.connection.a_raw_put( |
|
|
|
|
|
urls_patterns.URL_ADMIN_FLOW.format(**params_path), |
|
|
|
|
|
data=json.dumps(payload), |
|
|
) |
|
|
) |
|
|
return raise_error_from_response( |
|
|
return raise_error_from_response( |
|
|
data_raw, KeycloakPutError, expected_codes=[HTTP_ACCEPTED, HTTP_NO_CONTENT], |
|
|
|
|
|
|
|
|
data_raw, |
|
|
|
|
|
KeycloakPutError, |
|
|
|
|
|
expected_codes=[HTTP_ACCEPTED, HTTP_NO_CONTENT], |
|
|
) |
|
|
) |