|
|
|
@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
|
|
|
|
import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.CpUser.CpUserService; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.auth.AdminAuthServiceImpl; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.auth.UserSessionService; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.permission.PermissionService; |
|
|
|
|
import cn.iocoder.yudao.module.system.service.permission.RoleService; |
|
|
|
@ -74,6 +75,9 @@ public class AuthController {
|
|
|
|
|
@Resource |
|
|
|
|
private UserSessionService userSessionService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private AdminAuthServiceImpl adminAuthService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/login") |
|
|
|
|
@ApiOperation("使用账号密码登录") |
|
|
|
@ -112,6 +116,8 @@ public class AuthController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LoginUser login = AuthConvert.INSTANCE.convert(user); |
|
|
|
|
//权限
|
|
|
|
|
login.setRoleIds(adminAuthService.getUserRoleIds(login.getId())); |
|
|
|
|
String token = userSessionService.createUserSession(login, getClientIP(), getUserAgent()); |
|
|
|
|
|
|
|
|
|
log.info("TOKEN:::{}",token); |
|
|
|
|