diff --git a/README.md b/README.md
index fc5debe..a8fc9c1 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
# open-JSD-7844
-JSD-7844 OAuth2 + 基于时间戳签名的单点
\ No newline at end of file
+JSD-7844 OAuth2 + 基于时间戳签名的单点\
+免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
+仅作为开发者学习参考使用!禁止用于任何商业用途!\
+为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。
\ No newline at end of file
diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar
new file mode 100644
index 0000000..611c8f5
Binary files /dev/null and b/lib/finekit-10.0.jar differ
diff --git a/plugin.xml b/plugin.xml
new file mode 100644
index 0000000..40893ae
--- /dev/null
+++ b/plugin.xml
@@ -0,0 +1,17 @@
+
+
+ com.fr.plugin.third.party.jsd7844
+
+ yes
+ 0.1
+ 10.0
+ 2019-01-01
+ 追心
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/fr/plugin/third/party/jsdhiee/config/CustomDataConfig.java b/src/main/java/com/fr/plugin/third/party/jsdhiee/config/CustomDataConfig.java
new file mode 100644
index 0000000..2de39e1
--- /dev/null
+++ b/src/main/java/com/fr/plugin/third/party/jsdhiee/config/CustomDataConfig.java
@@ -0,0 +1,184 @@
+package com.fr.plugin.third.party.jsdhiee.config;
+
+
+import com.fanruan.api.util.StringKit;
+import com.fr.config.*;
+import com.fr.config.holder.Conf;
+import com.fr.config.holder.factory.Holders;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 配置数据保存
+ */
+@Visualization(category = "融创集成登录配置")
+public class CustomDataConfig extends DefaultConfiguration {
+ private static ConcurrentHashMap URL_MAP = new ConcurrentHashMap();
+
+ /**
+ * 添加链接
+ * @param key
+ * @param url
+ */
+ public static void addUrl(String key, String url) {
+ URL_MAP.put(key, url);
+ }
+
+ /**
+ * 获取链接并销毁保存
+ * @param key
+ * @return
+ */
+ public static String getUrlAndDestroy(String key) {
+ String url = URL_MAP.get(key);
+ URL_MAP.remove(key);
+ return url;
+ }
+
+
+ private static volatile CustomDataConfig config = null;
+
+ public static CustomDataConfig getInstance() {
+ if (config == null) {
+ config = ConfigContext.getConfigInstance(CustomDataConfig.class);
+ }
+ return config;
+ }
+
+ @Identifier(value = "appValidityDuration", name = "移动端有效期时长(分钟)", description = "单位:分钟", status = Status.SHOW)
+ private Conf appValidityDuration = Holders.simple(720);
+
+
+ @Identifier(value = "appSecurityKey", name = "移动端密钥(securityKey)", description = "", status = Status.SHOW)
+ private Conf appSecurityKey = Holders.simple(StringKit.EMPTY);
+
+
+ @Identifier(value = "idmClientId", name = "IDM系统应用唯一标识(client_id)", description = "", status = Status.SHOW)
+ private Conf idmClientId = Holders.simple("49e24f65da354dae8ed3a7e55633aaf3");
+
+
+ @Identifier(value = "idmClientSecret", name = "IDM系统应用密钥(client_secret)", description = "", status = Status.SHOW)
+ private Conf idmClientSecret = Holders.simple("ZZTFCvXcLkdCUH");
+
+
+ @Identifier(value = "frUrl", name = "报表地址(redirect_uri)", description = "", status = Status.SHOW)
+ private Conf frUrl = Holders.simple("http://10.199.201.108/webroot/decision");
+
+
+ @Identifier(value = "oAuthCodeUrl", name = "获取OAuth Code地址", description = "", status = Status.SHOW)
+ private Conf oAuthCodeUrl = Holders.simple("http://oamdev.sunac.com.cn/ms_oauth/oauth2/endpoints/oauthservice/authorize");
+
+
+ @Identifier(value = "accessTokenUrl", name = "获取Access Token地址", description = "", status = Status.SHOW)
+ private Conf accessTokenUrl = Holders.simple("http://oamdev.sunac.com.cn/ms_oauth/oauth2/endpoints/oauthservice/tokens");
+
+
+ @Identifier(value = "userUrl", name = "获取用户信息地址", description = "", status = Status.SHOW)
+ private Conf userUrl = Holders.simple("http://oamdev.sunac.com.cn/ms_oauth/resources/userprofile/me");
+
+
+ @Identifier(value = "loginTypeNameParameter", name = "登录类型参数名称", description = "", status = Status.SHOW)
+ private Conf loginTypeNameParameter = Holders.simple("loginType");
+
+
+ @Identifier(value = "loginTypeValue", name = "登录类型值", description = "", status = Status.SHOW)
+ private Conf loginTypeValue = Holders.simple("IDM_OAUTH");
+
+
+ public int getAppValidityDuration() {
+ return appValidityDuration.get();
+ }
+
+ public void setAppValidityDuration(int appValidityDuration) {
+ this.appValidityDuration.set(appValidityDuration);
+ }
+
+ public String getAppSecurityKey() {
+ return appSecurityKey.get();
+ }
+
+ public void setAppSecurityKey(String appSecurityKey) {
+ this.appSecurityKey.set(appSecurityKey);
+ }
+
+
+ public String getIdmClientId() {
+ return idmClientId.get();
+ }
+
+ public void setIdmClientId(String idmClientId) {
+ this.idmClientId.set(idmClientId);
+ }
+
+ public String getIdmClientSecret() {
+ return idmClientSecret.get();
+ }
+
+ public void setIdmClientSecret(String idmClientSecret) {
+ this.idmClientSecret.set(idmClientSecret);
+ }
+
+ public String getFrUrl() {
+ return frUrl.get();
+ }
+
+ public void setFrUrl(String frUrl) {
+ this.frUrl.set(frUrl);
+ }
+
+ public String getoAuthCodeUrl() {
+ return oAuthCodeUrl.get();
+ }
+
+ public void setoAuthCodeUrl(String oAuthCodeUrl) {
+ this.oAuthCodeUrl.set(oAuthCodeUrl);
+ }
+
+ public String getAccessTokenUrl() {
+ return accessTokenUrl.get();
+ }
+
+ public void setAccessTokenUrl(String accessTokenUrl) {
+ this.accessTokenUrl.set(accessTokenUrl);
+ }
+
+ public String getUserUrl() {
+ return userUrl.get();
+ }
+
+ public void setUserUrl(String userUrl) {
+ this.userUrl.set(userUrl);
+ }
+
+ public String getLoginTypeNameParameter() {
+ return loginTypeNameParameter.get();
+ }
+
+ public void setLoginTypeNameParameter(String loginTypeNameParameter) {
+ this.loginTypeNameParameter.set(loginTypeNameParameter);
+ }
+
+ public String getLoginTypeValue() {
+ return loginTypeValue.get();
+ }
+
+ public void setLoginTypeValue(String loginTypeValue) {
+ this.loginTypeValue.set(loginTypeValue);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ CustomDataConfig cloned = (CustomDataConfig) super.clone();
+ cloned.appValidityDuration = (Conf) appValidityDuration.clone();
+ cloned.appSecurityKey = (Conf) appSecurityKey.clone();
+ cloned.idmClientId = (Conf) idmClientId.clone();
+ cloned.idmClientSecret = (Conf) idmClientSecret.clone();
+ cloned.frUrl = (Conf) frUrl.clone();
+ cloned.oAuthCodeUrl = (Conf) oAuthCodeUrl.clone();
+ cloned.accessTokenUrl = (Conf) accessTokenUrl.clone();
+ cloned.userUrl = (Conf) userUrl.clone();
+ cloned.loginTypeNameParameter = (Conf) loginTypeNameParameter.clone();
+ cloned.loginTypeValue = (Conf) loginTypeValue.clone();
+ return cloned;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/third/party/jsdhiee/config/DataConfigInitializeMonitor.java b/src/main/java/com/fr/plugin/third/party/jsdhiee/config/DataConfigInitializeMonitor.java
new file mode 100644
index 0000000..fd97700
--- /dev/null
+++ b/src/main/java/com/fr/plugin/third/party/jsdhiee/config/DataConfigInitializeMonitor.java
@@ -0,0 +1,24 @@
+package com.fr.plugin.third.party.jsdhiee.config;
+
+import com.fr.intelli.record.Focus;
+import com.fr.intelli.record.Original;
+import com.fr.plugin.context.PluginContext;
+import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor;
+import com.fr.record.analyzer.EnableMetrics;
+
+/**
+ * 配置信息初始化
+ */
+@EnableMetrics
+public class DataConfigInitializeMonitor extends AbstractPluginLifecycleMonitor {
+ @Override
+ @Focus(id = "com.fr.plugin.third.party.jsd7844", text = "plugin-jsd-7844", source = Original.PLUGIN)
+ public void afterRun(PluginContext pluginContext) {
+ CustomDataConfig.getInstance();
+ }
+
+ @Override
+ public void beforeStop(PluginContext pluginContext) {
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fr/plugin/third/party/jsdhiee/http/SessionGlobalRequestFilterProvider.java b/src/main/java/com/fr/plugin/third/party/jsdhiee/http/SessionGlobalRequestFilterProvider.java
new file mode 100644
index 0000000..bd582fb
--- /dev/null
+++ b/src/main/java/com/fr/plugin/third/party/jsdhiee/http/SessionGlobalRequestFilterProvider.java
@@ -0,0 +1,554 @@
+package com.fr.plugin.third.party.jsdhiee.http;
+
+import com.fanruan.api.log.LogKit;
+import com.fanruan.api.util.StringKit;
+import com.fr.data.NetworkHelper;
+import com.fr.decision.authority.AuthorityContext;
+import com.fr.decision.authority.data.User;
+import com.fr.decision.fun.impl.AbstractGlobalRequestFilterProvider;
+import com.fr.decision.mobile.terminal.TerminalHandler;
+import com.fr.decision.webservice.v10.login.LoginService;
+import com.fr.decision.webservice.v10.login.TokenResource;
+import com.fr.decision.webservice.v10.user.UserService;
+import com.fr.general.ComparatorUtils;
+import com.fr.json.JSONObject;
+import com.fr.log.FineLoggerFactory;
+import com.fr.plugin.third.party.jsdhiee.config.CustomDataConfig;
+import com.fr.stable.StringUtils;
+import com.fr.stable.query.QueryFactory;
+import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
+import com.fr.third.org.apache.http.HttpEntity;
+import com.fr.third.org.apache.http.HttpHeaders;
+import com.fr.third.org.apache.http.HttpStatus;
+import com.fr.third.org.apache.http.NameValuePair;
+import com.fr.third.org.apache.http.client.config.RequestConfig;
+import com.fr.third.org.apache.http.client.entity.UrlEncodedFormEntity;
+import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
+import com.fr.third.org.apache.http.client.methods.HttpGet;
+import com.fr.third.org.apache.http.client.methods.HttpPost;
+import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
+import com.fr.third.org.apache.http.impl.client.HttpClients;
+import com.fr.third.org.apache.http.message.BasicNameValuePair;
+import com.fr.third.org.apache.http.util.EntityUtils;
+import com.fr.web.utils.WebUtils;
+
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
+
+
+public class SessionGlobalRequestFilterProvider extends AbstractGlobalRequestFilterProvider {
+ private static CloseableHttpClient httpClient = HttpClients.createDefault();
+ private static String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36";
+
+ @Override
+ public String filterName() {
+ return "com.fr.plugin.third.party.jsd7844";
+ }
+
+ @Override
+ public String[] urlPatterns() {
+ return new String[]{"/decision", "/decision/*"};
+ }
+
+ @Override
+ public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain filterChain) {
+ try {
+ String fullUrl = req.getRequestURL().toString();
+ String queryUrl = req.getQueryString();
+ if ("null".equalsIgnoreCase(queryUrl)) {
+ queryUrl = "";
+ } else {
+ queryUrl = "?" + queryUrl;
+ }
+
+ String fullUrl1 = fullUrl + queryUrl;
+ String method = req.getMethod();
+ LogKit.info("集成登录,记录访问地址:" + method + " " + fullUrl1);
+ if (fullUrl.indexOf("/remote/") >= 0) {
+ filterChain.doFilter(req, res);
+ return;
+ }
+
+ if (!"GET".equalsIgnoreCase(method)) {
+ filterChain.doFilter(req, res);
+ return;
+ }
+
+ // boolean option = isLogged(req);
+ // if (option) {
+ // filterChain.doFilter(req, res);
+ // return;
+ //}
+ if (isAllowIdmOAuthLogin(req)) {
+ String state = getUuid();
+ String requestUrl = getRequestUrl(req);
+ LogKit.info("集成登录,访问地址," + requestUrl);
+ CustomDataConfig.addUrl(state, requestUrl);
+ String locationUrl = getOAuthCodeUrl(state);
+ res.sendRedirect(locationUrl);
+ return;
+ }
+
+ String loginUsername = getIdmOAuthUsername(req);
+ boolean pcOption = false;
+ if (StringKit.isNotEmpty(loginUsername)) {
+ pcOption = true;
+ LogKit.info("集成登录,IDM OAuth 用户名:" + loginUsername);
+ }
+ if (StringKit.isEmpty(loginUsername)) {
+ filterChain.doFilter(req, res);
+ return;
+ }
+ loginUsername = loginUsername.toUpperCase();
+ User user = UserService.getInstance().getUserByUserName(loginUsername);
+ boolean tipsOption = false;
+ String tipsContent = "";
+ if (user == null) {
+ tipsOption = true;
+ LogKit.info("集成登录,用户名:" + loginUsername + "在报表平台不存在");
+ tipsContent = "在报表服务器上不存在";
+ } else if (!user.isEnable()) {
+ tipsOption = true;
+ LogKit.info("集成登录,用户名:" + loginUsername + "在报表平台上被禁用");
+ tipsContent = "在报表平台上被禁用";
+ }
+
+ if (tipsOption) {
+ String jumpContent = "\n" +
+ "\n" +
+ " \n" +
+ " 提示\n" +
+ "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "
\n" +
+ "\n" +
+ "