|
|
@@ -7,6 +7,7 @@ import com.uas.sso.SSOConfiguration;
|
|
|
import com.uas.sso.common.util.HttpUtil;
|
|
|
import com.uas.sso.sync.entity.*;
|
|
|
import com.uas.sso.sync.service.SyncSsoService;
|
|
|
+import com.uas.sso.util.DomainUtil;
|
|
|
import com.usoft.mq.utils.RabbitSendService;
|
|
|
import com.usoft.security.utils.OpenApiSignUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.Cookie;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLEncoder;
|
|
|
@@ -74,7 +76,7 @@ public class SyncSsoServiceImpl implements SyncSsoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void sendUserLoginStateToSso(Long spaceUU, Long userUU, HttpServletResponse response, Integer maxAge) {
|
|
|
+ public void sendUserLoginStateToSso(Long spaceUU, Long userUU, HttpServletResponse response, Integer maxAge, HttpServletRequest request) {
|
|
|
if (userUU == null) {
|
|
|
throw new RuntimeException("用户信息不能为空");
|
|
|
}
|
|
|
@@ -90,7 +92,7 @@ public class SyncSsoServiceImpl implements SyncSsoService {
|
|
|
// 设置cookies
|
|
|
Cookie tokenCookie = new Cookie("token", token);
|
|
|
tokenCookie.setPath("/");
|
|
|
- tokenCookie.setDomain(SSOConfig.getInstance().getCookieDomain());
|
|
|
+ tokenCookie.setDomain(DomainUtil.getFirstDomain(request));
|
|
|
if (maxAge != null) {
|
|
|
tokenCookie.setMaxAge(maxAge);
|
|
|
}
|