@RequestMapping(value = Constants.Url.LOGIN, method = RequestMethod.GET)
public String showLoginPage(@RequestParam(value = Constants.RequestParam.ERROR, required = false) Boolean error,
@RequestParam(value = Constants.RequestParam.LOGOUT, required = false) Boolean logout,
Model model) {
SecurityContext securityContext = SecurityContextHolder.getContext();
if (securityContext != null) {
Authentication authentication = securityContext.getAuthentication();
if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
return Constants.Url.REDIRECT + Constants.Url.ROOT;
}
}
if (error != null) {
model.addAttribute(Constants.ModelAttribute.ERROR, Constants.Messages.PAGE_LOGIN_ERROR_INVALID_USERNAME_AND_PASSWORD);
}
if (logout != null) {
model.addAttribute(Constants.ModelAttribute.LOGOUT, Constants.Messages.PAGE_LOGIN_MESSAGE_LOGOUT);
}
return Constants.View.LOGIN;
}
RootController.java 文件源码
java
阅读 49
收藏 0
点赞 0
评论 0
项目:java-spring-jspx-hibernate-template
作者:
评论列表
文章目录