JsonUtils rename method name

This commit is contained in:
MaxKey
2022-09-18 10:41:43 +08:00
parent 5617aa5c94
commit d22358bb98
29 changed files with 50 additions and 50 deletions

View File

@@ -98,7 +98,7 @@ public class ExtendApiCndnsApiMailAdapter extends AbstractAuthorizeAdapter {
String responseBody = new HttpRequestAdapter().post(
String.format(ADMIN_AUTHKEY_URI,details.getPrincipal(),sign,timestamp),requestParamenter);
HashMap<String, String> authKey=JsonUtils.gson2Object(responseBody, HashMap.class);
HashMap<String, String> authKey=JsonUtils.gsonStringToObject(responseBody, HashMap.class);
redirect_uri = authKey.get("adminUrl");
}else {
@@ -110,7 +110,7 @@ public class ExtendApiCndnsApiMailAdapter extends AbstractAuthorizeAdapter {
String responseBody = new HttpRequestAdapter().post(
String.format(AUTHKEY_URI,details.getPrincipal(),sign,timestamp),requestParamenter);
HashMap<String, String> authKey=JsonUtils.gson2Object(responseBody, HashMap.class);
HashMap<String, String> authKey=JsonUtils.gsonStringToObject(responseBody, HashMap.class);
redirect_uri=authKey.get("webmailUrl");
}

View File

@@ -96,7 +96,7 @@ public class ExtendApiQQExmailAdapter extends AbstractAuthorizeAdapter {
String accessToken = tokenCache.getIfPresent(corpid);
if(accessToken == null) {
String responseBody = new HttpRequestAdapter().get(String.format(TOKEN_URI,corpid,corpsecret),null);
Token token =JsonUtils.gson2Object(responseBody,Token.class);
Token token =JsonUtils.gsonStringToObject(responseBody,Token.class);
_logger.debug("access_token {}" , token);
accessToken = token.getAccess_token();
tokenCache.put(corpid, accessToken);
@@ -108,7 +108,7 @@ public class ExtendApiQQExmailAdapter extends AbstractAuthorizeAdapter {
_logger.debug("userId {}" , userId);
String authKeyBody = new HttpRequestAdapter().get(String.format(AUTHKEY_URI,accessToken,userId),null);
ExMailLoginUrl exMailLoginUrl = JsonUtils.gson2Object(authKeyBody, ExMailLoginUrl.class);
ExMailLoginUrl exMailLoginUrl = JsonUtils.gsonStringToObject(authKeyBody, ExMailLoginUrl.class);
_logger.debug("LoginUrl {} " , exMailLoginUrl);
return exMailLoginUrl;
}

View File

@@ -68,7 +68,7 @@ public class OAuthDefaultUserInfoAdapter extends AbstractAuthorizeAdapter {
beanMap.put("institution", userInfo.getInstId());
beanMap.put(WebConstants.ONLINE_TICKET_NAME, principal.getSession().getFormattedId());
String info= JsonUtils.object2Json(beanMap);
String info= JsonUtils.toString(beanMap);
return info;
}

View File

@@ -90,7 +90,7 @@ public class UserInfoEndpoint {
}
if (!StringGenerator.uuidMatches(access_token)) {
httpResponseAdapter.write(response,JsonUtils.gson2Json(accessTokenFormatError(access_token)),"json");
httpResponseAdapter.write(response,JsonUtils.gsonToString(accessTokenFormatError(access_token)),"json");
}
OAuth2Authentication oAuth2Authentication =null;
@@ -123,7 +123,7 @@ public class UserInfoEndpoint {
HashMap<String,Object>authzException=new HashMap<String,Object>();
authzException.put(OAuth2Exception.ERROR, e.getOAuth2ErrorCode());
authzException.put(OAuth2Exception.DESCRIPTION,e.getMessage());
httpResponseAdapter.write(response,JsonUtils.gson2Json(authzException),"json");
httpResponseAdapter.write(response,JsonUtils.gsonToString(authzException),"json");
}
}

View File

@@ -105,7 +105,7 @@ public class UserInfoOIDCEndpoint {
String access_token = AuthorizationHeaderUtils.resolveBearer(request);
if (!StringGenerator.uuidMatches(access_token)) {
return JsonUtils.gson2Json(accessTokenFormatError(access_token));
return JsonUtils.gsonToString(accessTokenFormatError(access_token));
}
String principal="";
@@ -275,7 +275,7 @@ public class UserInfoOIDCEndpoint {
HashMap<String,Object>authzException=new HashMap<String,Object>();
authzException.put(OAuth2Exception.ERROR, e.getOAuth2ErrorCode());
authzException.put(OAuth2Exception.DESCRIPTION,e.getMessage());
return JsonUtils.object2Json(authzException);
return JsonUtils.toString(authzException);
}
}

View File

@@ -90,7 +90,7 @@ public class TokenBasedDefaultAdapter extends AbstractAuthorizeAdapter {
beanMap.put("expires", expiresString);
token = JsonUtils.object2Json(beanMap);
token = JsonUtils.toString(beanMap);
_logger.debug("Token : {}",token);
return token;