@@ -3631,6 +3631,31 @@ def create_authentication_flow(self, payload: dict, skip_exists: bool = False) -
36313631 skip_exists = skip_exists ,
36323632 )
36333633
3634+ def update_authentication_flow (self , flow_id : str , payload : dict ) -> bytes :
3635+ """
3636+ Update an authentication flow.
3637+
3638+ AuthenticationFlowRepresentation
3639+ https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation
3640+
3641+ :param flow_id: The id of the flow
3642+ :type flow_id: str
3643+ :param payload: AuthenticationFlowRepresentation
3644+ :type payload: dict
3645+ :return: Keycloak server response
3646+ :rtype: bytes
3647+ """
3648+ params_path = {"id" : flow_id , "realm-name" : self .connection .realm_name }
3649+ data_raw = self .connection .raw_put (
3650+ urls_patterns .URL_ADMIN_FLOW .format (** params_path ),
3651+ data = json .dumps (payload ),
3652+ )
3653+ return raise_error_from_response (
3654+ data_raw ,
3655+ KeycloakPutError ,
3656+ expected_codes = [HTTP_ACCEPTED , HTTP_NO_CONTENT ],
3657+ )
3658+
36343659 def copy_authentication_flow (self , payload : dict , flow_alias : str ) -> bytes :
36353660 """
36363661 Copy existing authentication flow under a new name.
@@ -3782,6 +3807,45 @@ def delete_authentication_flow_execution(self, execution_id: str) -> bytes:
37823807 expected_codes = [HTTP_NO_CONTENT ],
37833808 )
37843809
3810+ def change_execution_priority (self , execution_id : str , diff : int ) -> None :
3811+ """
3812+ Raise or lower execution priority of diff time.
3813+
3814+ :param execution_id: The ID of the execution
3815+ :type execution_id: str
3816+ :param diff: The difference in priority, positive to raise, negative to lower, the value
3817+ is the number of times
3818+ :type diff: int
3819+ :raises KeycloakPostError: when post requests are failed
3820+ """
3821+ params_path = {"id" : execution_id , "realm-name" : self .connection .realm_name }
3822+ if diff > 0 :
3823+ for _ in range (diff ):
3824+ data_raw = self .connection .raw_post (
3825+ urls_patterns .URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY .format (
3826+ ** params_path ,
3827+ ),
3828+ data = "{}" ,
3829+ )
3830+ raise_error_from_response (
3831+ data_raw ,
3832+ KeycloakPostError ,
3833+ expected_codes = [HTTP_NO_CONTENT ],
3834+ )
3835+ elif diff < 0 :
3836+ for _ in range (- diff ):
3837+ data_raw = self .connection .raw_post (
3838+ urls_patterns .URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY .format (
3839+ ** params_path ,
3840+ ),
3841+ data = "{}" ,
3842+ )
3843+ raise_error_from_response (
3844+ data_raw ,
3845+ KeycloakPostError ,
3846+ expected_codes = [HTTP_NO_CONTENT ],
3847+ )
3848+
37853849 def create_authentication_flow_subflow (
37863850 self ,
37873851 payload : dict ,
@@ -3863,6 +3927,31 @@ def get_authenticator_config(self, config_id: str) -> dict:
38633927 )
38643928 return raise_error_from_response (data_raw , KeycloakGetError )
38653929
3930+ def create_execution_config (self , execution_id : str , payload : dict ) -> bytes :
3931+ """
3932+ Update execution with new configuration.
3933+
3934+ AuthenticatorConfigRepresentation
3935+ https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation
3936+
3937+ :param execution_id: The ID of the execution
3938+ :type execution_id: str
3939+ :param payload: Configuration to add to the execution
3940+ :type payload: dir
3941+ :return: Response(json)
3942+ :rtype: dict
3943+ """
3944+ params_path = {"id" : execution_id , "realm-name" : self .connection .realm_name }
3945+ data_raw = self .connection .raw_post (
3946+ urls_patterns .URL_ADMIN_FLOWS_EXECUTION_CONFIG .format (** params_path ),
3947+ data = json .dumps (payload ),
3948+ )
3949+ return raise_error_from_response (
3950+ data_raw ,
3951+ KeycloakPostError ,
3952+ expected_codes = [HTTP_CREATED ],
3953+ )
3954+
38663955 def update_authenticator_config (self , payload : dict , config_id : str ) -> bytes :
38673956 """
38683957 Update an authenticator configuration.
@@ -10492,3 +10581,92 @@ async def a_clear_user_cache(self) -> bytes:
1049210581 KeycloakPostError ,
1049310582 expected_codes = [HTTP_NO_CONTENT ],
1049410583 )
10584+
10585+ async def a_change_execution_priority (self , execution_id : str , diff : int ) -> None :
10586+ """
10587+ Raise or lower execution priority of diff time.
10588+
10589+ :param execution_id: The ID of the execution
10590+ :type execution_id: str
10591+ :param diff: The difference in priority, positive to raise, negative to lower, the value
10592+ is the number of times
10593+ :type diff: int
10594+ :raises KeycloakPostError: when post requests are failed
10595+ """
10596+ params_path = {"id" : execution_id , "realm-name" : self .connection .realm_name }
10597+ if diff > 0 :
10598+ for _ in range (diff ):
10599+ data_raw = await self .connection .a_raw_post (
10600+ urls_patterns .URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY .format (
10601+ ** params_path ,
10602+ ),
10603+ data = "{}" ,
10604+ )
10605+ raise_error_from_response (
10606+ data_raw ,
10607+ KeycloakPostError ,
10608+ expected_codes = [HTTP_NO_CONTENT ],
10609+ )
10610+ elif diff < 0 :
10611+ for _ in range (- diff ):
10612+ data_raw = await self .connection .a_raw_post (
10613+ urls_patterns .URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY .format (
10614+ ** params_path ,
10615+ ),
10616+ data = "{}" ,
10617+ )
10618+ raise_error_from_response (
10619+ data_raw ,
10620+ KeycloakPostError ,
10621+ expected_codes = [HTTP_NO_CONTENT ],
10622+ )
10623+
10624+ async def a_create_execution_config (self , execution_id : str , payload : dict ) -> bytes :
10625+ """
10626+ Update execution with new configuration.
10627+
10628+ AuthenticatorConfigRepresentation
10629+ https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticatorconfigrepresentation
10630+
10631+ :param execution_id: The ID of the execution
10632+ :type execution_id: str
10633+ :param payload: Configuration to add to the execution
10634+ :type payload: dir
10635+ :return: Response(json)
10636+ :rtype: dict
10637+ """
10638+ params_path = {"id" : execution_id , "realm-name" : self .connection .realm_name }
10639+ data_raw = await self .connection .a_raw_post (
10640+ urls_patterns .URL_ADMIN_FLOWS_EXECUTION_CONFIG .format (** params_path ),
10641+ data = json .dumps (payload ),
10642+ )
10643+ return raise_error_from_response (
10644+ data_raw ,
10645+ KeycloakPostError ,
10646+ expected_codes = [HTTP_CREATED ],
10647+ )
10648+
10649+ async def a_update_authentication_flow (self , flow_id : str , payload : dict ) -> bytes :
10650+ """
10651+ Update an authentication flow.
10652+
10653+ AuthenticationFlowRepresentation
10654+ https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_authenticationflowrepresentation
10655+
10656+ :param flow_id: The id of the flow
10657+ :type flow_id: str
10658+ :param payload: AuthenticationFlowRepresentation
10659+ :type payload: dict
10660+ :return: Keycloak server response
10661+ :rtype: bytes
10662+ """
10663+ params_path = {"id" : flow_id , "realm-name" : self .connection .realm_name }
10664+ data_raw = await self .connection .a_raw_put (
10665+ urls_patterns .URL_ADMIN_FLOW .format (** params_path ),
10666+ data = json .dumps (payload ),
10667+ )
10668+ return raise_error_from_response (
10669+ data_raw ,
10670+ KeycloakPutError ,
10671+ expected_codes = [HTTP_ACCEPTED , HTTP_NO_CONTENT ],
10672+ )
0 commit comments