|
@@ -20,6 +20,7 @@ import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.report.business.cache.WhuUserAuthCacheUtil;
|
|
|
+import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -32,7 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.servlet.http.HttpSession;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
@@ -59,6 +59,9 @@ public class WudaOpenApiController {
|
|
|
@Resource
|
|
|
TeachcloudCommonService teachcloudCommonService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ ReportCommonService reportCommonService;
|
|
|
+
|
|
|
@ApiOperation(value = "cas鉴权接口")
|
|
|
@RequestMapping(value = "/authentication", method = RequestMethod.GET)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回消息", response = Result.class)})
|
|
@@ -74,19 +77,12 @@ public class WudaOpenApiController {
|
|
|
response.sendRedirect(dictionaryConfig.sysDomain().getReportUrl() + basicSchool.getId() + "/" + uid);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "cas鉴权退出接口")
|
|
|
- @RequestMapping(value = "/authentication/logout", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "cas用户鉴权退出接口")
|
|
|
+ @RequestMapping(value = "/user/authentication/logout", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回消息", response = Result.class)})
|
|
|
@Aac(auth = BOOL.FALSE)
|
|
|
public void authenticationLogout(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
- HttpSession session = request.getSession();
|
|
|
- session.invalidate();
|
|
|
- log.info("logout is come in,session:{}", JacksonUtil.parseJson(session));
|
|
|
- String casLogoutURL = "http://cas.whu.edu.cn/authserver/logout";
|
|
|
- // service后面带的参数为应用的访问地址,需要使用URLEncoder进行编码
|
|
|
- String redirectURL = casLogoutURL + "?service=" + URLEncoder.encode("http://cas.whu.edu.cn/authserver/login", SystemConstant.CHARSET_NAME);
|
|
|
- response.setHeader("Access-Control-Allow-Origin", "*");
|
|
|
- response.sendRedirect(redirectURL);
|
|
|
+ reportCommonService.whuLogout();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "cas用户鉴权接口")
|