提交 6e2d2daf 编写于 作者: sq3536's avatar sq3536

cookie

上级 9e4ba2b7
...@@ -53,18 +53,14 @@ public class ClientAuthenticationResource ...@@ -53,18 +53,14 @@ public class ClientAuthenticationResource
@PostMapping(value = "v7/login") @PostMapping(value = "v7/login")
public ResponseEntity<AuthenticationInfo> login(@Validated @RequestBody AuthorizationLogin authorizationLogin, HttpServletResponse response){ public ResponseEntity<AuthenticationInfo> login(@Validated @RequestBody AuthorizationLogin authorizationLogin){
userDetailsService.resetByUsername(authorizationLogin.getUsername()); userDetailsService.resetByUsername(authorizationLogin.getUsername());
AuthenticationUser user = userDetailsService.loadUserByLogin(authorizationLogin.getUsername(),authorizationLogin.getPassword()); AuthenticationUser user = userDetailsService.loadUserByLogin(authorizationLogin.getUsername(),authorizationLogin.getPassword());
final String token = jwtTokenUtil.generateToken(user); final String token = jwtTokenUtil.generateToken(user);
user.setPermissionList(null); user.setPermissionList(null);
Cookie cookie=new Cookie("ibzuaa-token",token);
if(!StringUtils.isEmpty(cookiedomain))
cookie.setDomain(cookiedomain);
cookie.setMaxAge(0);
response.addCookie(cookie);
// 返回 token // 返回 token
return ResponseEntity.ok().body(new AuthenticationInfo(token,user)); return ResponseEntity.ok().body(new AuthenticationInfo(token,user));
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册