diff --git a/center/src/main/java/com/microsoft/hydralab/center/controller/AuthController.java b/center/src/main/java/com/microsoft/hydralab/center/controller/AuthController.java index f278ee9f0..af0bfcb65 100644 --- a/center/src/main/java/com/microsoft/hydralab/center/controller/AuthController.java +++ b/center/src/main/java/com/microsoft/hydralab/center/controller/AuthController.java @@ -63,13 +63,9 @@ public void getAccessToken(@RequestParam("code") String code, HttpServletRequest String state = request.getParameter("state"); String prefix = Const.FrontEndPath.INDEX_PATH + "?" + Const.FrontEndPath.REDIRECT_PARAM + "="; - if (StringUtils.isNotEmpty(state)) { - if (state.startsWith(prefix)) { - String newUrl = state.replace(prefix, ""); - if (LogUtils.isLegalStr(newUrl, Const.RegexString.URL, false)) { - redirectUrl = state; - } - } else if (state.equals(Const.FrontEndPath.SWAGGER_DOC_PATH)) { + if (StringUtils.isNotEmpty(state) && state.startsWith(prefix)) { + String newUrl = state.replace(prefix, ""); + if (LogUtils.isLegalStr(newUrl, Const.RegexString.URL, false)) { redirectUrl = state; } } diff --git a/center/src/main/java/com/microsoft/hydralab/center/interceptor/BaseInterceptor.java b/center/src/main/java/com/microsoft/hydralab/center/interceptor/BaseInterceptor.java index 4f1d7ce54..47b14f45f 100644 --- a/center/src/main/java/com/microsoft/hydralab/center/interceptor/BaseInterceptor.java +++ b/center/src/main/java/com/microsoft/hydralab/center/interceptor/BaseInterceptor.java @@ -96,8 +96,6 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons } else { response.sendRedirect(authUtil.getLoginUrl()); } - } else if (requestURI.equals(Const.FrontEndPath.SWAGGER_DOC_PATH)) { - response.sendRedirect(authUtil.getLoginUrl(requestURI, null)); } else { response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.setHeader("Location", authUtil.getLoginUrl()); diff --git a/common/src/main/java/com/microsoft/hydralab/common/util/Const.java b/common/src/main/java/com/microsoft/hydralab/common/util/Const.java index 44512cbbb..bb40eb234 100644 --- a/common/src/main/java/com/microsoft/hydralab/common/util/Const.java +++ b/common/src/main/java/com/microsoft/hydralab/common/util/Const.java @@ -109,7 +109,6 @@ interface FrontEndPath { String INDEX_PATH = "/portal/index.html"; String ANCHOR = "#"; String REDIRECT_PARAM = "redirectUrl"; - String SWAGGER_DOC_PATH = "/v3/api-docs"; } interface RegexString {