|
|
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import platform.common.Constant;
|
|
|
import platform.common.base.controller.BaseController;
|
|
|
+import platform.common.util.CookieUtil;
|
|
|
import platform.common.util.LoadPropertyUtil;
|
|
|
import platform.common.util.ShiroUtils;
|
|
|
import platform.modules.government.dao.UserDao;
|
|
|
@@ -24,6 +25,7 @@ import platform.modules.government.entity.User;
|
|
|
import platform.modules.government.service.UserService;
|
|
|
import platform.modules.sys.shiro.UsernamePasswordToken;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
|
|
|
/**
|
|
|
@@ -40,6 +42,9 @@ public class LoginCallback extends BaseController {
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HttpServletResponse response;
|
|
|
+
|
|
|
@PostMapping(value = "")
|
|
|
public String validateLogin(String SAMLResponse) {
|
|
|
log.info("! SAMLResponse = {}", SAMLResponse);
|
|
|
@@ -56,6 +61,10 @@ public class LoginCallback extends BaseController {
|
|
|
//token.setPassword(resetPassword.toCharArray());
|
|
|
token.setSSO(true);
|
|
|
SecurityUtils.getSubject().login(token);
|
|
|
+ // 注入token到cookie
|
|
|
+ String tokenString = userService.createToken();
|
|
|
+ CookieUtil.create(response, "INDUSTRIAL_CARRIER", tokenString, false, 7200,"/");
|
|
|
+ CookieUtil.create(response, "user_id", user.getId().toString(), false, 7200,"/");
|
|
|
return "redirect:/admin/home";
|
|
|
|
|
|
}
|