diff --git a/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java b/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java index 6eea439..fbd4647 100644 --- a/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java +++ b/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java @@ -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)); } } - // + /** + *

登录oa系统

+ * + * @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; - } + /** + *

跳转认证

+ * + * @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"));