Skip to content

Commit

Permalink
Fix constant typo (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivershen-wow authored Mar 1, 2023
1 parent 17d8e39 commit 361c282
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class WebMvcConfiguration implements WebMvcConfigurer {

@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/portal/").setViewName("forward:"+ Const.FontPath.INDEX_PATH);
registry.addViewController("/portal/").setViewName("forward:"+ Const.FrontEndPath.INDEX_PATH);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class AuthController {
*/
@GetMapping(value = {"/api/auth"}, produces = MediaType.APPLICATION_JSON_VALUE)
public void getAccessToken(@RequestParam("code") String code, HttpServletRequest request, HttpServletResponse response) throws IOException {
String redirectUrl = Const.FontPath.INDEX_PATH;
String redirectUrl = Const.FrontEndPath.INDEX_PATH;
String accessToken = authUtil.verifyCode(code);
if (accessToken == null) {
response.sendRedirect(authUtil.getLoginUrl());
Expand All @@ -55,7 +55,7 @@ public void getAccessToken(@RequestParam("code") String code, HttpServletRequest
securityUserService.addSessionAndUserAuth(authUtil.getLoginUserName(accessToken), accessToken, request.getSession());

String state = request.getParameter("state");
String prefix = Const.FontPath.INDEX_PATH + "?" + Const.FontPath.REDIRECT_PARAM + "=";
String prefix = Const.FrontEndPath.INDEX_PATH + "?" + Const.FrontEndPath.REDIRECT_PARAM + "=";

if (StringUtils.isNotEmpty(state) && state.startsWith(prefix)) {
String newUrl = state.replace(prefix, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
}
//invoke by browser
if (StringUtils.isEmpty(token) || !authUtil.verifyToken(token)) {
if (requestURI.contains(Const.FontPath.PREFIX_PATH)) {
if (requestURI.contains(Const.FrontEndPath.PREFIX_PATH)) {
String queryString = request.getQueryString();
if (StringUtils.isNotEmpty(queryString)
&& queryString.startsWith(Const.FontPath.REDIRECT_PARAM)
&& LogUtils.isLegalStr(queryString.replace(Const.FontPath.REDIRECT_PARAM + "=", ""), Const.RegexString.URL, false)
&& queryString.startsWith(Const.FrontEndPath.REDIRECT_PARAM)
&& LogUtils.isLegalStr(queryString.replace(Const.FrontEndPath.REDIRECT_PARAM + "=", ""), Const.RegexString.URL, false)
&& LogUtils.isLegalStr(requestURI, Const.RegexString.URL, true)
) {
response.sendRedirect(authUtil.getLoginUrl(requestURI, queryString));// CodeQL [java/unvalidated-url-redirection] False Positive: Has verified the string by regular expression
Expand All @@ -95,9 +95,9 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
return false;
}
//redirect
String redirectUrl = request.getParameter(Const.FontPath.REDIRECT_PARAM);
String redirectUrl = request.getParameter(Const.FrontEndPath.REDIRECT_PARAM);
if (StringUtils.isNotEmpty(redirectUrl) && LogUtils.isLegalStr(redirectUrl, Const.RegexString.URL, false)) {
response.sendRedirect(Const.FontPath.INDEX_PATH + Const.FontPath.ANCHOR + redirectUrl);// CodeQL [java/unvalidated-url-redirection] False Positive: Has verified the string by regular expression
response.sendRedirect(Const.FrontEndPath.INDEX_PATH + Const.FrontEndPath.ANCHOR + redirectUrl);// CodeQL [java/unvalidated-url-redirection] False Positive: Has verified the string by regular expression
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ interface DeviceStability {
String BEHAVIOUR_DISCONNECT = "disconnected";
}

interface FontPath {
interface FrontEndPath {
String PREFIX_PATH = "/portal";
String INDEX_PATH = "/portal/index.html";
String ANCHOR = "#";
Expand Down

0 comments on commit 361c282

Please sign in to comment.