|
|
|
@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.auth0.jwt.JWTVerifier; |
|
|
|
import com.zdxt.auth.feign.UserApi; |
|
|
|
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.project.system.user.service.IUserService; |
|
|
|
import com.zdxt.auth.project.system.user.util.AesHelper; |
|
|
|
import com.zdxt.code.domain.MssqAddOrder; |
|
|
|
import com.zdxt.code.domain.SiqLogin; |
|
|
|
import com.zdxt.code.service.MssqApiService; |
|
|
|
@ -19,6 +22,8 @@ import com.zdxt.common.util.RedisCache; |
|
|
|
import com.zdxt.domain.auth.User; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.codec.binary.Hex; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.apache.shiro.subject.Subject; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -73,17 +78,27 @@ public class AppThirdLoginController { |
|
|
|
private ZwSmsClient zwSmsClient; |
|
|
|
@Autowired |
|
|
|
private MssqApiService mssqApiService; |
|
|
|
@Autowired |
|
|
|
private IUserService userService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 深圳易平台登录 |
|
|
|
*/ |
|
|
|
@GetMapping("/testLogin/{userName}") |
|
|
|
@PostMapping("/testLogin") |
|
|
|
@ResponseBody |
|
|
|
public ZDResponse testLogin(@PathVariable String userName){ |
|
|
|
public ZDResponse testLogin(@RequestBody Map<String, String> params){ |
|
|
|
try { |
|
|
|
User user = iUserService.selectUserByLoginName(userName); |
|
|
|
String secretName = params.get("secretName"); |
|
|
|
String secretKey = params.get("secretKey"); |
|
|
|
//解密
|
|
|
|
secretKey = AesHelper.desEncrypt(secretKey); |
|
|
|
// UsernamePasswordToken token = new UsernamePasswordToken(username, password, false);
|
|
|
|
UserToken token = new UserToken(secretName, secretKey, LoginType.PASSWORD); |
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
subject.login(token); |
|
|
|
User user = userService.selectUserByLoginName(secretName); |
|
|
|
redisCache.setCacheObject("shiro:app:"+user.getUserId(), user); // todo:这里需要将转换出来的User存redis用于做权限
|
|
|
|
return thirdLoginService.szyLogin(user.getLoginName()); |
|
|
|
} catch (Exception e) { |
|
|
|
|