|
@@ -108,15 +108,14 @@ public class AuthorizationController {
|
|
|
return ResponseEntity.ok(authInfo);
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/login2")
|
|
|
- @Log("登录")
|
|
|
- @ApiOperation("登录")
|
|
|
- @AnonymousAccess
|
|
|
- public ResponseEntity<Object> login2(String username, HttpServletRequest request)throws Exception {
|
|
|
+ @ApiOperation("登录授权")
|
|
|
+ @AnonymousPostMapping(value = "/login2")
|
|
|
+ public ResponseEntity<Object> login2(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
|
|
+ System.out.println("authUser.getPassword():"+authUser.getPassword());
|
|
|
// 密码解密
|
|
|
- String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, "xacy4R9bjxrtoFamboN7Hi083pqqkul3+11NGYxwx2v9ZxsJ5pvopViUtGeB3Rv05Seb7fsaAs3I7YBzIc/vag==");
|
|
|
+ String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
|
|
UsernamePasswordAuthenticationToken authenticationToken =
|
|
|
- new UsernamePasswordAuthenticationToken(username, password);
|
|
|
+ new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
|
|
|
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
|
|
// 生成令牌
|
|
@@ -131,7 +130,7 @@ public class AuthorizationController {
|
|
|
}};
|
|
|
if (loginProperties.isSingleLogin()) {
|
|
|
//踢掉之前已经登录的token
|
|
|
- onlineUserService.checkLoginOnUser(username, token);
|
|
|
+ onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
|
|
|
}
|
|
|
return ResponseEntity.ok(authInfo);
|
|
|
}
|