Commit 5543af64 authored by AfirSraftGarrier's avatar AfirSraftGarrier

文档说明

parent 27f45898
......@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap;
import java.util.Map;
......@@ -33,7 +34,7 @@ public class LoginController {
static Map<String, LoginUser> userMap = new HashMap<>();
static {
LoginUser user1 = new LoginUser("2147483647","root", "123456");
LoginUser user1 = new LoginUser("2147483647", "root", "123456");
userMap.put("2147483647", user1);
}
......@@ -44,8 +45,8 @@ public class LoginController {
@GetMapping("login")
@MyLog(title = "登录", optParam = "#{userName},#{password}", businessType = BusinessType.OTHER)
@ApiImplicitParams({
@ApiImplicitParam(name = "userName",value = "用户名",required = true),
@ApiImplicitParam(name = "password",value = "密码",required = true)
@ApiImplicitParam(name = "userName", value = "用户名", required = true),
@ApiImplicitParam(name = "password", value = "密码", required = true)
})
public ResResult<LoginVo> login(@RequestParam("userName") String userName, @RequestParam("password") String password) {
......@@ -67,4 +68,10 @@ public class LoginController {
public BaseResult logout() {
return BaseResult.success();
}
@GetMapping("fail")
@ApiIgnore
public ResResult fail() {
return ResResult.fail().msg("认证信息非法");
}
}
......@@ -44,7 +44,7 @@ public class JwtFilter implements Filter {
String uri = request.getRequestURI();
if (uri.contains(url1) || uri.contains(url2) || uri.contains(url3) || uri.contains(url4) || uri.contains(url7) || uri.contains(url8)) {
if(uri.contains(url1) || uri.contains(url2) ) {
if (uri.contains(url1) || uri.contains(url2)) {
UserUtils.setUri(uri);
}
check = false;
......@@ -61,8 +61,7 @@ public class JwtFilter implements Filter {
} else {
DecodedJWT jwt = JwtUtil.verifyToken(token);
if (jwt == null) {
String resultStr = JSON.toJSONString(ResResult.fail().msg("认证信息非法"));
response.getWriter().write(resultStr);
request.getRequestDispatcher("/fail").forward(request, response);
return;
} else {
Map<String, Claim> userData = jwt.getClaims();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment