Commit 88a78ed3 authored by 马博's avatar 马博

hdcommon

parent 3fa9d5b7
...@@ -55,7 +55,7 @@ public class Authorization { ...@@ -55,7 +55,7 @@ public class Authorization {
private static Map<String,String> hdCookies; private static Map<String,String> hdCookies;
private static Map<String,String> hdCookiesMabo; private static Map<String,String> hdCookiesMabo;
private static Map<String,String> hdCookiesSaas; private static Map<String,String> hdCookiesSaas;
private static Map<String,String> hdCookiesCommon; private static Map<String,Map> hdCookiesCommon = new ConcurrentHashMap<>();
private static Map<String,String> openbsCookies; private static Map<String,String> openbsCookies;
private Map<String,String> ssoCookies =null; private Map<String,String> ssoCookies =null;
...@@ -264,7 +264,8 @@ public class Authorization { ...@@ -264,7 +264,8 @@ public class Authorization {
//密码为duibaduiba123 //密码为duibaduiba123
public Map hdLoginCommon(String email){ public Map hdLoginCommon(String email){
int i=10; int i=10;
while((hdCookiesCommon==null||hdCookiesCommon.size()==0)&&i>0) { Map<String,String> hdCookies = hdCookiesCommon.get(email);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken(); Response token=this.hdGetToken();
String url = PROTOCOL + hdHost + hdLoginPath; String url = PROTOCOL + hdHost + hdLoginPath;
Map<String,String> cookies=token.getCookies(); Map<String,String> cookies=token.getCookies();
...@@ -274,13 +275,17 @@ public class Authorization { ...@@ -274,13 +275,17 @@ public class Authorization {
paras.put("redirect", "/redirectApp"); paras.put("redirect", "/redirectApp");
paras.put("isAutoLogin", "true"); paras.put("isAutoLogin", "true");
Response response = given().cookies(cookies).params(paras).post(url); Response response = given().cookies(cookies).params(paras).post(url);
hdCookiesCommon=new HashMap<>(response.getCookies()); hdCookies=new HashMap<>(response.getCookies());
if(hdCookies==null||hdCookies.size()==0){
hdCookies.remove("csrf_token");
hdCookiesCommon.put(email,hdCookies);
}
i--; i--;
} }
//取消安全校验 //取消安全校验
hdCookiesCommon.remove("csrf_token");
// logger.info(hdCookies); // logger.info(hdCookies);
return hdCookiesCommon; return hdCookies;
} }
public Response hdGetToken(){ public Response hdGetToken(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment