|
@@ -170,11 +170,22 @@ public class SSOLoginLogoutController {
|
|
|
@RequestMapping(value = "/tzlogin", method = RequestMethod.POST)
|
|
|
public LoginResult tzlogin(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModelDTO dto){
|
|
|
|
|
|
+ String eiToken = "";
|
|
|
+
|
|
|
+ Cookie[] cookies = request.getCookies();
|
|
|
+ if (cookies != null) {
|
|
|
+ for (Cookie cookie : cookies) {
|
|
|
+ if (cookie.getName().equals("EIToken")) {
|
|
|
+ eiToken = cookie.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
LoginResult loginResult = new LoginResult();
|
|
|
Result<JSONObject> result = new Result<JSONObject>();
|
|
|
String usernameSSO = dto.getUsername();
|
|
|
String password = dto.getPassword();
|
|
|
- String eiToken = dto.getEiToken();
|
|
|
+// String eiToken = dto.getEiToken();
|
|
|
String lsToken = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
|
|
|
|
|
if(eiToken!=null && !"".equals(eiToken)){
|
|
@@ -233,6 +244,17 @@ public class SSOLoginLogoutController {
|
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
|
public Result<JSONObject> login(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModel sysLoginModel){
|
|
|
|
|
|
+ Cookie[] cookies = request.getCookies();
|
|
|
+ if (cookies != null) {
|
|
|
+ for (Cookie cookie : cookies) {
|
|
|
+ if (cookie.getName().equals("EIToken")) {
|
|
|
+ String t = cookie.getValue();
|
|
|
+ // 可以在这里处理tokenValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // TODO 要做判断啥的么?
|
|
|
+
|
|
|
Result<JSONObject> result = new Result<JSONObject>();
|
|
|
String username = sysLoginModel.getUsername();
|
|
|
String password = sysLoginModel.getPassword();
|
|
@@ -243,6 +265,8 @@ public class SSOLoginLogoutController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ response.setHeader("Set-Cookie", String.format("EIToken=%s; Max-Age=3600; Path=/; Secure; SameSite=None", eiToken));
|
|
|
+
|
|
|
//1. 校验用户是否有效
|
|
|
SysUser sysUser = sysUserService.getUserAll(username);
|
|
|
result = sysUserService.checkUserIsEffective(sysUser);
|
|
@@ -485,6 +509,8 @@ public class SSOLoginLogoutController {
|
|
|
String msg = IoTedgessolgout(response);
|
|
|
if(!SSOConstants.LOGOUT_SUCCESS.equals(msg)) return Result.error(msg);
|
|
|
|
|
|
+ response.setHeader("Set-Cookie", String.format("EIToken=%s; Max-Age=0; Path=/; Secure; SameSite=None", ""));
|
|
|
+
|
|
|
//用户退出逻辑
|
|
|
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
|
|
if(oConvertUtils.isEmpty(token)) {
|