Skip to content

Commit

Permalink
Revert "Add swagger doc api path for oauth redirect (#567)"
Browse files Browse the repository at this point in the history
This reverts commit ed4f5d4.
  • Loading branch information
olivershen-wow committed Sep 12, 2023
1 parent 8da7d5b commit d363d72
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d363d72

Please sign in to comment.