security框架功能

This commit is contained in:
谢洪龙
2017-07-21 17:57:55 +08:00
parent 5c4332cf61
commit 234e360f3e
23 changed files with 2110 additions and 13 deletions
+35 -2
View File
@@ -1,7 +1,12 @@
package com.ifish.controller;
import java.util.Calendar;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
/*
@@ -16,8 +21,36 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
public class Index {
@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView Index() {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout,
String ReturnUrl, HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
if (error != null) {
if (StringUtils.isNotBlank(error)) {
mv.addObject("error", error);
} else {
mv.addObject("error", "用户名密码不对!");
}
}
if (logout != null) {
mv.addObject("msg", "退出成功.");
if (StringUtils.isNotBlank(ReturnUrl)) {
mv.setViewName("redirect:/");
return mv;
}
}
mv.setViewName("index");
return mv;
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public Object test() {
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;