|
| 1 | +/* |
| 2 | + * Zed Attack Proxy (ZAP) and its related class files. |
| 3 | + * |
| 4 | + * ZAP is an HTTP/HTTPS proxy for assessing web application security. |
| 5 | + * |
| 6 | + * Copyright 2020 The ZAP Development Team |
| 7 | + * |
| 8 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | + * you may not use this file except in compliance with the License. |
| 10 | + * You may obtain a copy of the License at |
| 11 | + * |
| 12 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | + * |
| 14 | + * Unless required by applicable law or agreed to in writing, software |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | + * See the License for the specific language governing permissions and |
| 18 | + * limitations under the License. |
| 19 | + */ |
| 20 | +package org.zaproxy.clientapi.gen; |
| 21 | + |
| 22 | +import java.util.HashMap; |
| 23 | +import java.util.Map; |
| 24 | +import org.zaproxy.clientapi.core.ApiResponse; |
| 25 | +import org.zaproxy.clientapi.core.ClientApi; |
| 26 | +import org.zaproxy.clientapi.core.ClientApiException; |
| 27 | + |
| 28 | +/** This file was automatically generated. */ |
| 29 | +@SuppressWarnings("javadoc") |
| 30 | +public class AccessControl { |
| 31 | + |
| 32 | + private final ClientApi api; |
| 33 | + |
| 34 | + public AccessControl(ClientApi api) { |
| 35 | + this.api = api; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Gets the Access Control scan progress (percentage integer) for the given context ID. |
| 40 | + * |
| 41 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 42 | + */ |
| 43 | + public ApiResponse getScanProgress(String contextid) throws ClientApiException { |
| 44 | + Map<String, String> map = new HashMap<>(); |
| 45 | + map.put("contextId", contextid); |
| 46 | + return api.callApi("accessControl", "view", "getScanProgress", map); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Gets the Access Control scan status (description string) for the given context ID. |
| 51 | + * |
| 52 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 53 | + */ |
| 54 | + public ApiResponse getScanStatus(String contextid) throws ClientApiException { |
| 55 | + Map<String, String> map = new HashMap<>(); |
| 56 | + map.put("contextId", contextid); |
| 57 | + return api.callApi("accessControl", "view", "getScanStatus", map); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Starts an Access Control scan with the given context ID and user ID. (Optional parameters: |
| 62 | + * user ID for Unauthenticated user, boolean identifying whether or not Alerts are raised, and |
| 63 | + * the Risk level for the Alerts.) [This assumes the Access Control rules were previously |
| 64 | + * established via ZAP gui and the necessary Context exported/imported.] |
| 65 | + * |
| 66 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 67 | + */ |
| 68 | + public ApiResponse scan( |
| 69 | + String contextid, |
| 70 | + String userid, |
| 71 | + String scanasunauthuser, |
| 72 | + String raisealert, |
| 73 | + String alertrisklevel) |
| 74 | + throws ClientApiException { |
| 75 | + Map<String, String> map = new HashMap<>(); |
| 76 | + map.put("contextId", contextid); |
| 77 | + map.put("userId", userid); |
| 78 | + if (scanasunauthuser != null) { |
| 79 | + map.put("scanAsUnAuthUser", scanasunauthuser); |
| 80 | + } |
| 81 | + if (raisealert != null) { |
| 82 | + map.put("raiseAlert", raisealert); |
| 83 | + } |
| 84 | + if (alertrisklevel != null) { |
| 85 | + map.put("alertRiskLevel", alertrisklevel); |
| 86 | + } |
| 87 | + return api.callApi("accessControl", "action", "scan", map); |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Generates an Access Control report for the given context ID and saves it based on the |
| 92 | + * provided filename (path). |
| 93 | + * |
| 94 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 95 | + */ |
| 96 | + public ApiResponse writeHTMLreport(String contextid, String filename) |
| 97 | + throws ClientApiException { |
| 98 | + Map<String, String> map = new HashMap<>(); |
| 99 | + map.put("contextId", contextid); |
| 100 | + map.put("fileName", filename); |
| 101 | + return api.callApi("accessControl", "action", "writeHTMLreport", map); |
| 102 | + } |
| 103 | +} |
0 commit comments