|
@@ -37,8 +37,6 @@ public class OAToSHR extends HttpServlet {
|
|
|
private Properties prop = new Properties();
|
|
|
private String propPath = System.getProperty("EAS_HOME") + "/server/properties/scy/OASSOConfig.properties";
|
|
|
|
|
|
- private final String SECRETKEY = "jOK7MpIonY+/56ulnl6RGQ==";
|
|
|
-
|
|
|
@Override
|
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
|
|
|
throws ServletException, IOException {
|
|
@@ -122,8 +120,6 @@ public class OAToSHR extends HttpServlet {
|
|
|
String key = System.currentTimeMillis() + String.valueOf(random.nextInt(99999));
|
|
|
redirectUrlCache.put(key, redirectUrl,300000);
|
|
|
logger.error("callBack redirectUrl" + redirectUrl);
|
|
|
- //String encrypt = encrypt(redirectUrl, SECRETKEY);
|
|
|
- //logger.error("callBack encrypt" + encrypt);
|
|
|
redirect_uri1 += "?redirect=" + key;
|
|
|
Map params = new HashMap();
|
|
|
params.put("client_id", client_id);
|
|
@@ -213,7 +209,6 @@ public class OAToSHR extends HttpServlet {
|
|
|
redirectUrlStr.append(serverName).append("/shr/dynamic.do?uipk=shr.perself.homepage");
|
|
|
} else {
|
|
|
String redirectUrl = redirectUrlCache.get(redirectUrlKey);
|
|
|
- //String decrpt = decrypt(redirectUrl, SECRETKEY);
|
|
|
if (redirectUrl.contains(serverName)) {
|
|
|
redirectUrlStr.append(redirectUrl);
|
|
|
} else {
|
|
@@ -332,7 +327,6 @@ public class OAToSHR extends HttpServlet {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 拼接地址参数
|
|
|
*/
|
|
@@ -348,30 +342,4 @@ public class OAToSHR extends HttpServlet {
|
|
|
logger.error("拼接后的地址为:" + str);
|
|
|
return str;
|
|
|
}
|
|
|
-
|
|
|
- // 使用 AES 加密
|
|
|
- public static String encrypt(String plainText, String encodedKey) throws Exception {
|
|
|
- // 将Base64字符串解码为字节数组
|
|
|
- byte[] decodedKey = Base64.getDecoder().decode(encodedKey);
|
|
|
- // 使用字节数组创建一个AES密钥
|
|
|
- SecretKey secretKey = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES");
|
|
|
- Cipher cipher = Cipher.getInstance("AES");
|
|
|
- cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
|
|
- byte[] encryptedBytes = cipher.doFinal(plainText.getBytes("UTF-8"));
|
|
|
- return Base64.getEncoder().encodeToString(encryptedBytes);
|
|
|
- }
|
|
|
-
|
|
|
- // 使用 AES 解密
|
|
|
- public static String decrypt(String encryptedText, String encodedKey) throws Exception {
|
|
|
- // 将Base64字符串解码为字节数组
|
|
|
- byte[] decodedKey = Base64.getDecoder().decode(encodedKey);
|
|
|
- // 使用字节数组创建一个AES密钥
|
|
|
- SecretKey secretKey = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES");
|
|
|
- Cipher cipher = Cipher.getInstance("AES");
|
|
|
- cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
|
|
- byte[] decodedBytes = Base64.getDecoder().decode(encryptedText);
|
|
|
- byte[] decryptedBytes = cipher.doFinal(decodedBytes);
|
|
|
- return new String(decryptedBytes, "UTF-8");
|
|
|
- }
|
|
|
-
|
|
|
}
|