From 0107aa9f0f2101110e3d1a79602a3e663bbbf8c8 Mon Sep 17 00:00:00 2001 From: Piotr Borelowski Date: Tue, 10 Sep 2019 13:48:01 +0200 Subject: [PATCH] Stop Swagger UI interface in workflow-designer-be Implemented DisableSwaggerController to respond with NOT_FOUND status when asked for swagger-ui.html. Issue-ID: OJSI-31 Signed-off-by: Piotr Borelowski Change-Id: I0dd580cb7a936c28c028dd6c1168468c40a9dc3b --- .../sdc/workflow/api/DisableSwaggerController.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/DisableSwaggerController.java 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 index 00000000..44aa8bb7 --- /dev/null +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/DisableSwaggerController.java @@ -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()); + } +} -- 2.16.6