国小君统一认证加注释
parent
c44c3355d5
commit
f84b755516
|
@ -27,7 +27,6 @@ import java.util.Objects;
|
|||
public class SsoGuoXiaoJunPocImpl {
|
||||
|
||||
public static final String API_SSO_URL = "/api/aiyh/guoxiaojun/sso";
|
||||
public static final String LOGIN_URL = "/wui/index.html";
|
||||
public static final String API_CHECK_OUT_URI = "/api/hrm/login/checkLogout";
|
||||
private final Logger log = Util.getLogger();
|
||||
|
||||
|
@ -55,20 +54,24 @@ public class SsoGuoXiaoJunPocImpl {
|
|||
if (requestURI.equals(API_CHECK_OUT_URI)) {
|
||||
// 退出登录
|
||||
session.removeAttribute("outUserId");
|
||||
String logOutUrl = Util.getCusConfigValue("oauth2-proxy-logout-url");
|
||||
response.setHeader("logOutUrl", logOutUrl);
|
||||
return;
|
||||
}
|
||||
// sso 认证
|
||||
if (session.getAttribute("outUserId") == null) {
|
||||
authorSso(response, session);
|
||||
authorSso(response);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("重定地址失败!" + Util.getErrString(e));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* <h2>登录oa系统</h2>
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
private void loginOa(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
HttpSession session;
|
||||
String outUserId = request.getHeader("X-Credential-Identifier");
|
||||
|
@ -84,11 +87,13 @@ public class SsoGuoXiaoJunPocImpl {
|
|||
response.sendRedirect(Util.getCusConfigValueNullOrEmpty("SSO_SUCCESS_REDIRECT_URL", "/wui/index.html"));
|
||||
}
|
||||
|
||||
private void authorSso(HttpServletResponse response, HttpSession session) throws IOException {
|
||||
Object outUserId = session.getAttribute("outUserId");
|
||||
if (Objects.nonNull(outUserId)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* <h2>跳转认证</h2>
|
||||
*
|
||||
* @param response 响应
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
private void authorSso(HttpServletResponse response) throws IOException {
|
||||
// 地址重定向到国小君aut2认证地址
|
||||
response.sendRedirect(Util.getCusConfigValue("oauth2-proxy-url") + "?url="
|
||||
+ URLEncoder.encode(Util.getCusConfigValue("OA_URL") + API_SSO_URL, "UTF-8"));
|
||||
|
|
Loading…
Reference in New Issue