I have a spring mvc web application with the following code. When the user is not logged in I am sending one tiles view.
And when the user is logged in I am redirecting to specific url patterns.
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login() throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("Requested with /login mapping");
}
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!(authentication instanceof AnonymousAuthenticationToken)) {
List<String> userRoles = AuthenticationUtils.getUserRoles();
if (userRoles.contains("ROLE_ADMIN")) {
return "redirect:/admin.html";
} else if (userRoles.contains("ROLE_USER")) {
return "redirect:/user.html";
}
}
return "template";
}
I am getting the redirection but with some unexpected parameters. How to remove them?
http://localhost:8081/app/admin.html?total=48&loggedInUserRoles=207
I have tried the following url without success.
Spring MVC Controller: Redirect without parameters being added to my url
I have no clue of which part of code is adding the parameters.