|
|
@@ -0,0 +1,472 @@
|
|
|
+package com.kingdee.bos.sso.client.filter.authentication;
|
|
|
+
|
|
|
+import com.kingdee.bos.BOSException;
|
|
|
+import com.kingdee.bos.Context;
|
|
|
+import com.kingdee.bos.dao.IObjectValue;
|
|
|
+import com.kingdee.bos.metadata.entity.EntityViewInfo;
|
|
|
+import com.kingdee.bos.metadata.entity.FilterInfo;
|
|
|
+import com.kingdee.bos.metadata.entity.FilterItemInfo;
|
|
|
+import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
+import com.kingdee.bos.sso.client.util.CommonUtils;
|
|
|
+import com.kingdee.bos.sso.client.util.ConfigAddressUtil;
|
|
|
+import com.kingdee.bos.sso.client.util.FilterUtil;
|
|
|
+import com.kingdee.bos.sso.client.util.StringUtil;
|
|
|
+import com.kingdee.eas.base.myeas.PrivacyStatementCustomCollection;
|
|
|
+import com.kingdee.eas.base.myeas.PrivacyStatementCustomFactory;
|
|
|
+import com.kingdee.eas.base.myeas.PrivacyStatementCustomInfo;
|
|
|
+import com.kingdee.eas.base.myeas.PrivacyStatementFactory;
|
|
|
+import com.kingdee.eas.base.usermonitor.IUserMonitor;
|
|
|
+import com.kingdee.eas.base.usermonitor.UserMonitorFactory;
|
|
|
+import com.kingdee.eas.base.usermonitor.UserMonitorSessionInfo;
|
|
|
+import com.kingdee.eas.cp.common.web.util.WebContextUtil;
|
|
|
+import com.kingdee.eas.cp.eip.sso.qrcode.helper.QrCodeTokenHelper;
|
|
|
+import com.kingdee.util.StringUtils;
|
|
|
+import java.io.IOException;
|
|
|
+import java.lang.reflect.Field;
|
|
|
+import java.net.MalformedURLException;
|
|
|
+import java.net.URL;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import javax.servlet.FilterChain;
|
|
|
+import javax.servlet.ServletException;
|
|
|
+import javax.servlet.ServletRequest;
|
|
|
+import javax.servlet.ServletResponse;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.servlet.http.HttpSession;
|
|
|
+import org.jasig.cas.client.Protocol;
|
|
|
+import org.jasig.cas.client.authentication.AuthenticationRedirectStrategy;
|
|
|
+import org.jasig.cas.client.authentication.ContainsPatternUrlPatternMatcherStrategy;
|
|
|
+import org.jasig.cas.client.authentication.DefaultAuthenticationRedirectStrategy;
|
|
|
+import org.jasig.cas.client.authentication.DefaultGatewayResolverImpl;
|
|
|
+import org.jasig.cas.client.authentication.EntireRegionRegexUrlPatternMatcherStrategy;
|
|
|
+import org.jasig.cas.client.authentication.ExactUrlPatternMatcherStrategy;
|
|
|
+import org.jasig.cas.client.authentication.GatewayResolver;
|
|
|
+import org.jasig.cas.client.authentication.RegexUrlPatternMatcherStrategy;
|
|
|
+import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
|
|
|
+import org.jasig.cas.client.configuration.ConfigurationKeys;
|
|
|
+import org.jasig.cas.client.util.AbstractCasFilter;
|
|
|
+import org.jasig.cas.client.validation.Assertion;
|
|
|
+
|
|
|
+public class KDPortalAuthenticationFilter extends AbstractCasFilter {
|
|
|
+ private boolean getServerNameFromRequest;
|
|
|
+ private boolean getServerLoginUrlFromRequest;
|
|
|
+ private String serverLoginUrl;
|
|
|
+ private String casServerLoginUrl;
|
|
|
+ private boolean renew;
|
|
|
+ private boolean gateway;
|
|
|
+ private String method;
|
|
|
+ private GatewayResolver gatewayStorage;
|
|
|
+ private AuthenticationRedirectStrategy authenticationRedirectStrategy;
|
|
|
+ private static final Map<String, Class<? extends UrlPatternMatcherStrategy>> PATTERN_MATCHER_TYPES = new HashMap();
|
|
|
+
|
|
|
+ static {
|
|
|
+ PATTERN_MATCHER_TYPES.put("CONTAINS", ContainsPatternUrlPatternMatcherStrategy.class);
|
|
|
+ PATTERN_MATCHER_TYPES.put("REGEX", RegexUrlPatternMatcherStrategy.class);
|
|
|
+ PATTERN_MATCHER_TYPES.put("FULL_REGEX", EntireRegionRegexUrlPatternMatcherStrategy.class);
|
|
|
+ PATTERN_MATCHER_TYPES.put("EXACT", ExactUrlPatternMatcherStrategy.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ public KDPortalAuthenticationFilter() {
|
|
|
+ this(Protocol.CAS2);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected KDPortalAuthenticationFilter(Protocol protocol) {
|
|
|
+ super(protocol);
|
|
|
+ this.renew = false;
|
|
|
+ this.gateway = false;
|
|
|
+ this.gatewayStorage = new DefaultGatewayResolverImpl();
|
|
|
+ this.authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void init() {
|
|
|
+ super.init();
|
|
|
+ String message = String.format("one of %s and %s must not be null.", ConfigurationKeys.CAS_SERVER_LOGIN_URL.getName(), ConfigurationKeys.CAS_SERVER_URL_PREFIX.getName());
|
|
|
+ CommonUtils.assertNotNull(this.casServerLoginUrl, message);
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
|
|
+ HttpServletRequest request = (HttpServletRequest)servletRequest;
|
|
|
+ HttpServletResponse response = (HttpServletResponse)servletResponse;
|
|
|
+ if (this.isRequestUrlExcluded(request)) {
|
|
|
+ this.logger.debug("Request is ignored.");
|
|
|
+ filterChain.doFilter(request, response);
|
|
|
+ } else {
|
|
|
+ boolean sessionRenew = false;
|
|
|
+ String userNum = "";
|
|
|
+ HttpSession session = request.getSession(false);
|
|
|
+ String servletPath = request.getServletPath();
|
|
|
+ String assignmentId = request.getParameter("AssignmentId");
|
|
|
+ this.logger.info("doFilter..........判断是否移动端:servletPath{} ", servletPath);
|
|
|
+ this.logger.info("doFilter..........assignmentId{} ", assignmentId);
|
|
|
+ String isAdauth = String.valueOf(request.getSession(false).getAttribute("isAdauth"));
|
|
|
+ String password = request.getParameter("password");
|
|
|
+ String kdacctoken = request.getParameter("kdacctoken");
|
|
|
+ this.logger.info("doFilter..........isAdauth{} ", isAdauth);
|
|
|
+ this.logger.info("doFilter..........password{} ", password);
|
|
|
+ this.logger.info("doFilter..........kdacctoken{} ", kdacctoken);
|
|
|
+ boolean flag = false;
|
|
|
+ if ("/web_frame/easrpc/loginCheck.action".equals(servletPath) && (!StringUtils.isEmpty(password) || StringUtils.isEmpty(kdacctoken))) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("/shr/msf/service.do".equals(servletPath) || "/web_frame/easrpc/login.do".equals(servletPath)) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("/mulLan.do".equals(request.getServletPath())) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!"true".equals(isAdauth) && "/home.do".equals(servletPath)) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("/adsso".equals(servletPath)) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ String username = request.getParameter("kdacccode");
|
|
|
+ this.logger.info("doFilter..........进入移动端2:username1{} ", username);
|
|
|
+ if (StringUtils.isEmpty(username)) {
|
|
|
+ username = request.getParameter("username");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(username)) {
|
|
|
+ username = request.getParameter("usern");
|
|
|
+ }
|
|
|
+
|
|
|
+ this.logger.info("doFilter..........进入移动端2:username2{} ", username);
|
|
|
+ Assertion assertion;
|
|
|
+ String serviceUrl;
|
|
|
+ if (username != null) {
|
|
|
+ HttpSession httpSession = request.getSession(false);
|
|
|
+ assertion = httpSession != null ? (Assertion)httpSession.getAttribute("_const_cas_assertion_") : null;
|
|
|
+ if (assertion != null) {
|
|
|
+ username = URLDecoder.decode(username, "UTF-8");
|
|
|
+ this.logger.info("doFilter..........进入移动端2:username3{} ", username);
|
|
|
+ serviceUrl = assertion.getPrincipal().getName();
|
|
|
+ userNum = serviceUrl;
|
|
|
+ this.logger.info("doFilter..........进入移动端2:ctxUsername{} ", serviceUrl);
|
|
|
+ this.logger.info("doFilter..........进入移动端2:userNum{} ", serviceUrl);
|
|
|
+ if (serviceUrl != null && !serviceUrl.equalsIgnoreCase(username)) {
|
|
|
+ httpSession.setAttribute("_const_cas_assertion_", (Object)null);
|
|
|
+ httpSession.setAttribute("KD_PORTAL_IS_INIT_CONTEXT", (Object)null);
|
|
|
+ httpSession.invalidate();
|
|
|
+ sessionRenew = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (httpSession.getAttribute("userMonitorSessionInfo") != null) {
|
|
|
+ UserMonitorSessionInfo userMonitorSessionInfo = (UserMonitorSessionInfo)httpSession.getAttribute("userMonitorSessionInfo");
|
|
|
+
|
|
|
+ try {
|
|
|
+ IUserMonitor iUserMonitor = UserMonitorFactory.getRemoteInstance();
|
|
|
+ IObjectValue info = iUserMonitor.getValue(userMonitorSessionInfo.getId());
|
|
|
+ if (info == null) {
|
|
|
+ httpSession.setAttribute("_const_cas_assertion_", (Object)null);
|
|
|
+ httpSession.setAttribute("KD_PORTAL_IS_INIT_CONTEXT", (Object)null);
|
|
|
+ httpSession.invalidate();
|
|
|
+ sessionRenew = true;
|
|
|
+ }
|
|
|
+ } catch (Exception var26) {
|
|
|
+ this.logger.error("checkUserBeTicked err!", var26);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String queryString;
|
|
|
+ String requestURL;
|
|
|
+ String constructServerName;
|
|
|
+ String userNumber;
|
|
|
+ String urlToRedirectTo;
|
|
|
+ if ("/webviews/workflow/transferApprove.jsp".equals(servletPath)) {
|
|
|
+ constructServerName = request.getHeader("user-agent");
|
|
|
+ this.logger.info("doFilter..........进入移动端2:requestHeader{} ", constructServerName);
|
|
|
+ int type = this.getDeviceType(constructServerName);
|
|
|
+ serviceUrl = null;
|
|
|
+ userNumber = "";
|
|
|
+ if (session != null) {
|
|
|
+ Object userNumberObject = session.getAttribute("userNumber");
|
|
|
+ if (userNumberObject != null) {
|
|
|
+ userNumber = (String)userNumberObject;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.logger.info("doFilter..........进入移动端2:userNumber{} ", userNumber);
|
|
|
+ if (type == 1 || type == 2) {
|
|
|
+ this.logger.info("doFilter..........进入移动端2.getDeviceType:type{} ", type);
|
|
|
+ this.logger.info("doFilter..........进入移动端2.getDeviceType:userNum{} ", userNum);
|
|
|
+ Map<String, String> param2 = new HashMap();
|
|
|
+ param2.put("assignmentId", assignmentId);
|
|
|
+ session.setAttribute("assignment", param2);
|
|
|
+ if (!StringUtils.isEmpty(userNumber)) {
|
|
|
+ urlToRedirectTo = ConfigAddressUtil.getProperty("url");
|
|
|
+ queryString = ConfigAddressUtil.getProperty("mobileEid");
|
|
|
+ requestURL = urlToRedirectTo + "/index2.do?eid=" + queryString + "&appid=10036¶m=" + userNumber;
|
|
|
+ this.logger.info("doFilter.......进入移动端2...redirect{} ", requestURL);
|
|
|
+ response.sendRedirect(requestURL);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.logger.info("doFilter..........不跳移动端2:{} ", servletPath);
|
|
|
+ this.setEncodeServiceUrl(true);
|
|
|
+ this.constructLoginUrl(servletRequest, sessionRenew);
|
|
|
+ constructServerName = this.constructServerName(servletRequest);
|
|
|
+ assertion = session != null ? (Assertion)session.getAttribute("_const_cas_assertion_") : null;
|
|
|
+ if (assertion != null) {
|
|
|
+ serviceUrl = request.getHeader("x-requested-with");
|
|
|
+ if (!"XMLHttpRequest".equals(serviceUrl) && this.checkIsNeedPirvacyStatement(request)) {
|
|
|
+ this.logger.info("xrequestedwith......{}", serviceUrl);
|
|
|
+ this.logger.info("request......{}", request);
|
|
|
+ userNumber = this.constructServiceUrl(request, response);
|
|
|
+ this.logger.info("constructServiceUrl......{}", userNumber);
|
|
|
+ String url = "/portal";
|
|
|
+ if (userNumber.contains("shr")) {
|
|
|
+ url = "/shr";
|
|
|
+ }
|
|
|
+
|
|
|
+ response.sendRedirect("/eassso/privacyStatement/privacyStatementView.jsp?redirect=" + url);
|
|
|
+ } else {
|
|
|
+ filterChain.doFilter(request, response);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ serviceUrl = CommonUtils.constructServiceUrl(request, response, (String)null, this.getServerName(constructServerName), this.getProtocol().getServiceParameterName(), this.getProtocol().getArtifactParameterName(), true);
|
|
|
+ userNumber = this.retrieveTicketFromRequest(request);
|
|
|
+ boolean wasGatewayed = this.gateway && this.gatewayStorage.hasGatewayedAlready(request, serviceUrl);
|
|
|
+ if (!CommonUtils.isNotBlank(userNumber) && !wasGatewayed) {
|
|
|
+ this.logger.debug("no ticket and no assertion found");
|
|
|
+ String modifiedServiceUrl;
|
|
|
+ if (this.gateway) {
|
|
|
+ this.logger.debug("setting gateway attribute in session");
|
|
|
+ modifiedServiceUrl = this.gatewayStorage.storeGatewayInformation(request, serviceUrl);
|
|
|
+ } else {
|
|
|
+ modifiedServiceUrl = serviceUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.logger.debug("Constructed service url: {}", modifiedServiceUrl);
|
|
|
+ urlToRedirectTo = CommonUtils.constructRedirectUrl(this.casServerLoginUrl, this.getProtocol().getServiceParameterName(), modifiedServiceUrl, this.renew, this.gateway, this.method);
|
|
|
+ this.logger.debug("redirecting to \"{}\"", urlToRedirectTo);
|
|
|
+ if (!flag) {
|
|
|
+ urlToRedirectTo = ConfigAddressUtil.getProperty("authUrl") + "?client_id=" + ConfigAddressUtil.getProperty("client_id") + "&response_type=code&redirect_uri=" + ConfigAddressUtil.getProperty("url") + "&response_mode=query&scope=openid%20https%3A%2F%2Fgraph.microsoft.com%2Fuser.read&state=12345";
|
|
|
+ this.logger.info("Request is RequestURL..........{}", request.getRequestURL());
|
|
|
+ this.logger.info("Request is QueryString..........{}", request.getQueryString());
|
|
|
+ session.setAttribute("isAdauth", "true");
|
|
|
+ queryString = request.getQueryString();
|
|
|
+ requestURL = String.valueOf(request.getRequestURL());
|
|
|
+ if (!StringUtils.isEmpty(queryString) && !StringUtils.isEmpty(requestURL)) {
|
|
|
+ Map<String, String> param = new HashMap();
|
|
|
+ param.put("urlTo", requestURL + "?" + queryString);
|
|
|
+ this.logger.info("Request is urlTo..........{}", requestURL + "?" + queryString);
|
|
|
+ session.setAttribute("urlToMap", param);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.logger.info("doFilter.........urlToRedirectTo{}:", urlToRedirectTo);
|
|
|
+ this.authenticationRedirectStrategy.redirect(request, response, urlToRedirectTo);
|
|
|
+ } else {
|
|
|
+ filterChain.doFilter(request, response);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected String retrieveTicketFromRequest(HttpServletRequest request) {
|
|
|
+ String code = request.getParameter("code");
|
|
|
+ return !StringUtil.isEmpty(code) ? code : super.retrieveTicketFromRequest(request);
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean checkIsNeedPirvacyStatement(HttpServletRequest request) {
|
|
|
+ Context easContext = WebContextUtil.getEasContext(request);
|
|
|
+ if (easContext == null) {
|
|
|
+ return false;
|
|
|
+ } else if (easContext.get("privacyStatementKey") != null) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ String userId = easContext.getCaller().toString();
|
|
|
+ if (!"00000000-0000-0000-0000-00000000000013B7DE7F".equalsIgnoreCase(userId) && !"00000000-0000-0000-0000-00000000000213B7DE7F".equalsIgnoreCase(userId) && !"Wp3rRSFxRCaPFjuE2apQjRO33n8=".equalsIgnoreCase(userId) && !"00000000-0000-0000-0000-00000000000113B7DE7F".equalsIgnoreCase(userId) && !"256c221a-0106-1000-e000-10d7c0a813f413B7DE7F".equalsIgnoreCase(userId)) {
|
|
|
+ int privacyStatement = QrCodeTokenHelper.getPrivacyStatement();
|
|
|
+ if (privacyStatement == 0) {
|
|
|
+ easContext.put("privacyStatementKey", 4);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ int count = 0;
|
|
|
+ String htmlContent = "";
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (privacyStatement == 1) {
|
|
|
+ String versionTime = "YS20220901";
|
|
|
+ EntityViewInfo entityViewInfo = new EntityViewInfo();
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("userid", userId, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("versionTime", versionTime, CompareType.EQUALS));
|
|
|
+ entityViewInfo.setFilter(filterInfo);
|
|
|
+ count = PrivacyStatementFactory.getLocalInstance(easContext).getPrivacyStatementCollection(entityViewInfo).size();
|
|
|
+ } else {
|
|
|
+ EntityViewInfo entityViewInfo = new EntityViewInfo();
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("status", "ENABLE", CompareType.EQUALS));
|
|
|
+ entityViewInfo.setFilter(filterInfo);
|
|
|
+ PrivacyStatementCustomCollection customInfos = PrivacyStatementCustomFactory.getLocalInstance(easContext).getPrivacyStatementCustomCollection(entityViewInfo);
|
|
|
+ if (customInfos.size() != 0) {
|
|
|
+ PrivacyStatementCustomInfo privacyStatementCustomInfo = customInfos.get(0);
|
|
|
+ filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("privacyCusId", privacyStatementCustomInfo.getId().toString(), CompareType.EQUALS));
|
|
|
+ entityViewInfo = new EntityViewInfo();
|
|
|
+ entityViewInfo.setFilter(filterInfo);
|
|
|
+ count = PrivacyStatementFactory.getLocalInstance(easContext).getPrivacyStatementCollection(entityViewInfo).size();
|
|
|
+ System.out.println("--- privacy state doExecute --count:" + count);
|
|
|
+ htmlContent = privacyStatementCustomInfo.getHtmlContent();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (count > 0) {
|
|
|
+ easContext.put("privacyStatementKey", 1);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } catch (BOSException var11) {
|
|
|
+ var11.printStackTrace();
|
|
|
+ easContext.put("privacyStatementKey", 2);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ request.setAttribute("htmlContent", htmlContent);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ easContext.put("privacyStatementKey", 3);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getServerName(String constructServerName) {
|
|
|
+ if (constructServerName != null) {
|
|
|
+ return constructServerName;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ Class<?> clazz = this.getClass().getSuperclass();
|
|
|
+ Field field = clazz.getDeclaredField("serverName");
|
|
|
+ field.setAccessible(true);
|
|
|
+ return (String)field.get(this);
|
|
|
+ } catch (Exception var4) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String constructServerName(ServletRequest request) {
|
|
|
+ if (this.getServerNameFromRequest) {
|
|
|
+ StringBuilder serverName = new StringBuilder();
|
|
|
+ serverName.append(request.getServerName());
|
|
|
+ serverName.append(":");
|
|
|
+ serverName.append(request.getServerPort());
|
|
|
+ this.setServerName(serverName.toString());
|
|
|
+ return serverName.toString();
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void constructLoginUrl(ServletRequest request, boolean sessionRenew) {
|
|
|
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
|
|
|
+ HttpSession session = httpRequest.getSession(false);
|
|
|
+ Assertion assertion = session != null ? (Assertion)session.getAttribute("_const_cas_assertion_") : null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ URL contextURL = new URL(this.serverLoginUrl);
|
|
|
+ URL destURL = contextURL;
|
|
|
+ if (this.getServerLoginUrlFromRequest) {
|
|
|
+ destURL = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), contextURL.getFile());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (assertion != null) {
|
|
|
+ this.setCasServerLoginUrl(destURL.toString());
|
|
|
+ } else {
|
|
|
+ String dataCenter = request.getParameter("dataCenter");
|
|
|
+ String dbType = request.getParameter("dbType");
|
|
|
+ String locale = request.getParameter("locale");
|
|
|
+ String renew = request.getParameter("renew");
|
|
|
+ if (sessionRenew) {
|
|
|
+ renew = "true";
|
|
|
+ }
|
|
|
+
|
|
|
+ String optionParam = "";
|
|
|
+ if (dataCenter != null && !"".equals(dataCenter.trim())) {
|
|
|
+ optionParam = optionParam + (optionParam.startsWith("?") ? "&dataCenter=" : "?dataCenter=") + dataCenter;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dbType != null && !"".equals(dbType.trim())) {
|
|
|
+ optionParam = optionParam + (optionParam.startsWith("?") ? "&dbType=" : "?dbType=") + dbType;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (locale != null && !"".equals(locale.trim())) {
|
|
|
+ optionParam = optionParam + (optionParam.startsWith("?") ? "&locale=" : "?locale=") + locale;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (renew != null && !"".equals(renew.trim())) {
|
|
|
+ optionParam = optionParam + (optionParam.startsWith("?") ? "&renew=" : "?renew=") + renew;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setCasServerLoginUrl(destURL.toString() + optionParam);
|
|
|
+ }
|
|
|
+ } catch (MalformedURLException var13) {
|
|
|
+ var13.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setRenew(boolean renew) {
|
|
|
+ this.renew = renew;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setGateway(boolean gateway) {
|
|
|
+ this.gateway = gateway;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMethod(String method) {
|
|
|
+ this.method = method;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setCasServerUrlPrefix(String casServerUrlPrefix) {
|
|
|
+ this.setCasServerLoginUrl(CommonUtils.addTrailingSlash(casServerUrlPrefix) + "login");
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setCasServerLoginUrl(String casServerLoginUrl) {
|
|
|
+ this.casServerLoginUrl = casServerLoginUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setGatewayStorage(GatewayResolver gatewayStorage) {
|
|
|
+ this.gatewayStorage = gatewayStorage;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isRequestUrlExcluded(HttpServletRequest request) throws MalformedURLException {
|
|
|
+ return FilterUtil.isUnFilter(request);
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setIgnoreUrlPatternMatcherStrategyClass(UrlPatternMatcherStrategy ignoreUrlPatternMatcherStrategyClass) {
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setServerLoginUrl(String serverLoginUrl) {
|
|
|
+ this.serverLoginUrl = serverLoginUrl;
|
|
|
+ this.setCasServerLoginUrl(this.serverLoginUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setGetServerNameFromRequest(boolean getServerNameFromRequest) {
|
|
|
+ this.getServerNameFromRequest = getServerNameFromRequest;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setGetServerLoginUrlFromRequest(boolean getServerLoginUrlFromRequest) {
|
|
|
+ this.getServerLoginUrlFromRequest = getServerLoginUrlFromRequest;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int getDeviceType(String requestHeader) {
|
|
|
+ if (requestHeader.indexOf("Android") != -1) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return requestHeader.indexOf("iPhone") == -1 && requestHeader.indexOf("iPad") == -1 ? 3 : 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|