/** * Recursively find all AuthenticationExecutionModel from specified flow or all it's subflows * * @param realm * @param flow * @param result input should be empty list. At the end will be all executions added to this list */ public static void deepFindAuthenticationExecutions(RealmModel realm, AuthenticationFlowModel flow, List<AuthenticationExecutionModel> result) { List<AuthenticationExecutionModel> executions = realm.getAuthenticationExecutions(flow.getId()); for (AuthenticationExecutionModel execution : executions) { if (execution.isAuthenticatorFlow()) { AuthenticationFlowModel subFlow = realm.getAuthenticationFlowById(execution.getFlowId()); deepFindAuthenticationExecutions(realm, subFlow, result); } else { result.add(execution); } } }
KeycloakModelUtils.deepFindAuthenticationExecutions(realm, browserFlow, browserExecutions); for (AuthenticationExecutionModel browserExecution : browserExecutions) { if (browserExecution.getAuthenticator().equals("auth-otp-form")) {