This commit is contained in:
xiangwb
2018-04-02 11:40:56 +08:00
parent a97ae33afb
commit ac0a4071e8
6 changed files with 15 additions and 52 deletions
@@ -21,19 +21,6 @@ import java.util.List;
*/
@Configuration
public class DispatcherServletConfig extends WebMvcConfigurerAdapter {
/***
* 添加拦截器
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
//拦截器1:登录判断
// registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
// registry.addInterceptor(new LoginInterceptor())
// .addPathPatterns("/**").excludePathPatterns("/user/login", "/servlet/captchaCode", "/swagger-ui.html");
//拦截器2...
super.addInterceptors(registry);
}
/**
* 配置静态访问资源
@@ -1,9 +1,6 @@
package com.xwbing.controller.sys;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* 项目名称: boot-module-demo
@@ -14,16 +11,16 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
public class IndexController
{
@RequestMapping("/login")
public ModelAndView login() {
return new ModelAndView("login");
}
@GetMapping("/unauthor")
public String unauthor() {
return "redirect:login";
}
@GetMapping("/index")
public String index() {
return "suecess.html";
}
// @RequestMapping("/login")
// public ModelAndView login() {
// return new ModelAndView("login");
// }
// @GetMapping("/unauthor")
// public String unauthor() {
// return "redirect:login";
// }
// @GetMapping("/index")
// public String index() {
// return "suecess.html";
// }
}
@@ -159,7 +159,7 @@ public class SysUserControl {
return JsonResult.toJSONObj("没有获取到用户登录信息");
}
@LogInfo("当前用修改密码")
@LogInfo("当前用户修改密码")
@ApiOperation(value = "当前用户修改密码", response = RestMessageVo.class)
@PostMapping("updatePassWord")
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord) {
@@ -36,9 +36,8 @@ public class ShiroConfig {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager());
//如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
shiroFilterFactoryBean.setLoginUrl("/login");
shiroFilterFactoryBean.setSuccessUrl("/index");
shiroFilterFactoryBean.setUnauthorizedUrl("/redirect:unauthor");
shiroFilterFactoryBean.setLoginUrl("/login.html");
shiroFilterFactoryBean.setUnauthorizedUrl("/login.html");
Map<String, String> chains = new LinkedHashMap<>();
//静态资源
chains.put("/META-INF/resources/**", "anon");
@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to the world</title>
</head>
<body>
<h2>404</h2>
</body>
</html>
@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>seccess</title>
</head>
<body>
<h2>seccess</h2>
</body>
</html>