Stop Swagger UI interface in workflow-designer-be 46/95346/1
authorPiotr Borelowski <p.borelowski@partner.samsung.com>
Tue, 10 Sep 2019 11:48:01 +0000 (13:48 +0200)
committerPiotr Borelowski <p.borelowski@partner.samsung.com>
Tue, 10 Sep 2019 11:48:36 +0000 (13:48 +0200)
Implemented DisableSwaggerController to respond with NOT_FOUND status
when asked for swagger-ui.html.

Issue-ID: OJSI-31
Signed-off-by: Piotr Borelowski <p.borelowski@partner.samsung.com>
Change-Id: I0dd580cb7a936c28c028dd6c1168468c40a9dc3b

workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/DisableSwaggerController.java [new file with mode: 0644]

diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/DisableSwaggerController.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/DisableSwaggerController.java
new file mode 100644 (file)
index 0000000..44aa8bb
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2019 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.sdc.workflow.api;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Profile("!dev")
+@RestController
+public class DisableSwaggerController {
+    @RequestMapping("swagger-ui.html")
+    public void swagger(HttpServletResponse response) {
+        response.setStatus(HttpStatus.NOT_FOUND.value());
+    }
+}