diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/user_config/LoginStepBuilder.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/user_config/LoginStepBuilder.jsx index f0f2dc9d43..37ff6c8ec8 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/user_config/LoginStepBuilder.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/user_config/LoginStepBuilder.jsx @@ -1,4 +1,4 @@ -import { LegacyCard, Tabs, Text, Button, ButtonGroup, Divider } from '@shopify/polaris'; +import { LegacyCard, Tabs, Text, Button, ButtonGroup, Divider, HorizontalStack, Checkbox } from '@shopify/polaris'; import { useState, useEffect } from 'react'; import SpinnerCentered from '../../../components/progress/SpinnerCentered'; import DropdownSearch from '../../../components/shared/DropdownSearch'; @@ -23,6 +23,7 @@ function LoginStepBuilder({extractInformation, showOnlyApi, setStoreData}) { regex: "(\d+){1,6}", type: "LOGIN_FORM", url: "https://xyz.com", + allowAllStatusCodes: false, testResponse: "" } @@ -86,6 +87,14 @@ function LoginStepBuilder({extractInformation, showOnlyApi, setStoreData}) { setSelectedStep(step) } + function handleStatusCodeToggle(val) { + setSteps(prev => prev.map((step, index) => index === selectedStep ? { + ...step, + allowAllStatusCodes: val + } + : step)) + } + function handleStepTypeChange(type) { if (type === "LOGIN_FORM") { setSteps(prev => prev.map((step, index) => index === selectedStep ? { @@ -166,7 +175,14 @@ function LoginStepBuilder({extractInformation, showOnlyApi, setStoreData}) {
- + + handleStatusCodeToggle(!steps[selectedStep].allowAllStatusCodes)} + /> + +
diff --git a/apps/testing/src/main/java/com/akto/testing/workflow_node_executor/Utils.java b/apps/testing/src/main/java/com/akto/testing/workflow_node_executor/Utils.java index aecbccbe39..e2cfcb3256 100644 --- a/apps/testing/src/main/java/com/akto/testing/workflow_node_executor/Utils.java +++ b/apps/testing/src/main/java/com/akto/testing/workflow_node_executor/Utils.java @@ -236,10 +236,15 @@ public static LoginFlowResponse runLoginFlow(WorkflowTest workflowTest, AuthMech Map valuesMap = constructValueMap(loginFlowParams); + int index = 0; for (Node node: nodes) { + boolean allowAllStatusCodes = false; WorkflowTestResult.NodeResult nodeResult; try { - nodeResult = processNode(node, valuesMap, false, false, new ArrayList<>()); + if (authMechanism.getRequestData() != null && authMechanism.getRequestData().size() > 0 && authMechanism.getRequestData().get(index).getAllowAllStatusCodes()) { + allowAllStatusCodes = authMechanism.getRequestData().get(0).getAllowAllStatusCodes(); + } + nodeResult = processNode(node, valuesMap, allowAllStatusCodes, false, new ArrayList<>()); } catch (Exception e) { ; List testErrors = new ArrayList<>(); @@ -261,6 +266,7 @@ public static LoginFlowResponse runLoginFlow(WorkflowTest workflowTest, AuthMech saveValueMapData(loginFlowParams, valuesMap); } } + index++; } diff --git a/libs/dao/src/main/java/com/akto/dto/testing/RequestData.java b/libs/dao/src/main/java/com/akto/dto/testing/RequestData.java index 6e8325dd20..01082864a8 100644 --- a/libs/dao/src/main/java/com/akto/dto/testing/RequestData.java +++ b/libs/dao/src/main/java/com/akto/dto/testing/RequestData.java @@ -20,8 +20,11 @@ public class RequestData { private String tokenFetchCommand; + private boolean allowAllStatusCodes; + public RequestData() { } - public RequestData(String body, String headers, String queryParams, String url, String method, String type, String regex, String otpRefUuid, String tokenFetchCommand) { + public RequestData(String body, String headers, String queryParams, String url, String method, + String type, String regex, String otpRefUuid, String tokenFetchCommand, boolean allowAllStatusCodes) { this.body = body; this.headers = headers; this.queryParams = queryParams; @@ -102,4 +105,11 @@ public void setOtpRefUuid(String otpRefUuid) { public void setTokenFetchCommand(String tokenFetchCommand) { this.tokenFetchCommand = tokenFetchCommand; } + + public boolean getAllowAllStatusCodes() { + return allowAllStatusCodes; + } + public void setAllowAllStatusCodes(boolean allowAllStatusCodes) { + this.allowAllStatusCodes = allowAllStatusCodes; + } }