|
|
|
@ -8,6 +8,7 @@ import com.zdxt.auth.framework.shiro.jwt.JWTUtils; |
|
|
|
import com.zdxt.auth.framework.shiro.nopaddword.LoginType; |
|
|
|
import com.zdxt.auth.framework.shiro.nopaddword.UserToken; |
|
|
|
import com.zdxt.auth.framework.shiro.service.PasswordService; |
|
|
|
import com.zdxt.auth.project.system.user.domain.LoginDTO; |
|
|
|
import com.zdxt.auth.project.system.user.service.ITcUserCidService; |
|
|
|
import com.zdxt.auth.project.system.user.service.IUserService; |
|
|
|
import com.zdxt.auth.project.system.user.util.AesHelper; |
|
|
|
@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import com.zdxt.auth.common.utils.ServletUtils; |
|
|
|
import com.zdxt.auth.common.utils.StringUtils; |
|
|
|
@ -177,20 +179,20 @@ public class LoginController extends BaseController |
|
|
|
|
|
|
|
@PostMapping("/appLogin") |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult appLogin(String secretName, String secretKey) { |
|
|
|
public AjaxResult appLogin(@RequestBody LoginDTO loginDTO) { |
|
|
|
SecurityUtils.getSubject().logout(); |
|
|
|
// username = username.toUpperCase();
|
|
|
|
//解密
|
|
|
|
secretKey = AesHelper.desEncrypt(secretKey); |
|
|
|
loginDTO.setSecretKey(AesHelper.desEncrypt(loginDTO.getSecretKey())); |
|
|
|
// UsernamePasswordToken token = new UsernamePasswordToken(username, password, false);
|
|
|
|
UserToken token = new UserToken(secretName, secretKey, LoginType.PASSWORD); |
|
|
|
UserToken token = new UserToken(loginDTO.getSecretName(), loginDTO.getSecretKey(), LoginType.PASSWORD); |
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
try { |
|
|
|
//PC
|
|
|
|
subject.login(token); |
|
|
|
|
|
|
|
// 把 tonken 塞进去
|
|
|
|
User userDB = iUserService.selectUserByLoginName(secretName); |
|
|
|
User userDB = iUserService.selectUserByLoginName(loginDTO.getSecretName()); |
|
|
|
Map<String,Object> payload = new HashMap<>(); |
|
|
|
payload.put("id", userDB.getUserId()); |
|
|
|
payload.put("name", userDB.getLoginName()); |
|
|
|
|