org.apache.oltu.oauth2.common.utils.JSONUtils.parseJSON()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.apache.oltu.oauth2.common.utils.JSONUtils.parseJSON()方法的一些代码示例,展示了JSONUtils.parseJSON()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONUtils.parseJSON()方法的具体详情如下:
包路径:org.apache.oltu.oauth2.common.utils.JSONUtils
类名称:JSONUtils
方法名:parseJSON

JSONUtils.parseJSON介绍

暂无

代码示例

代码示例来源:origin: apache/oltu

protected void setBody(String body) throws OAuthProblemException {
  try {
    this.body = body;
    parameters = JSONUtils.parseJSON(body);
  } catch (Throwable e) {
    throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE,
      "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded");
  }
}

代码示例来源:origin: org.apache.oltu.oauth2/org.apache.oltu.oauth2.client

protected void setBody(String body) throws OAuthProblemException {
  try {
    this.body = body;
    parameters = JSONUtils.parseJSON(body);
  } catch (Throwable e) {
    throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE,
      "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded");
  }
}

代码示例来源:origin: apache/oltu

protected void setBody(String body) throws OAuthProblemException {
  try {
    this.body = body;
    parameters = JSONUtils.parseJSON(body);
  } catch (Throwable e) {
    throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE,
      "Invalid response! Response body is not application/json encoded");
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.application.authenticator.social

private Map<String, Object> getUserInfoJson(String fbAuthUserInfoUrl, String userInfoFields, String token)
    throws ApplicationAuthenticatorException {
  String userInfoString = getUserInfoString(fbAuthUserInfoUrl, userInfoFields, token);
  if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_ID_TOKEN)) {
    log.debug("UserInfoString : " + userInfoString);
  }
  Map<String, Object> jsonObject = JSONUtils.parseJSON(userInfoString);
  return jsonObject;
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.application.authenticator.facebook

private Map<String, Object> getUserInfoJson(String fbAuthUserInfoUrl, String userInfoFields, String token)
    throws ApplicationAuthenticatorException {
  String userInfoString = getUserInfoString(fbAuthUserInfoUrl, userInfoFields, token);
  if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_ID_TOKEN)) {
    log.debug("UserInfoString : " + userInfoString);
  }
  Map<String, Object> jsonObject = JSONUtils.parseJSON(userInfoString);
  return jsonObject;
}

代码示例来源:origin: org.wso2.carbon.identity.outbound.auth.facebook/org.wso2.carbon.identity.application.authenticator.facebook

protected Map<String, Object> getUserInfoJson(String fbAuthUserInfoUrl, String userInfoFields, String token)
    throws ApplicationAuthenticatorException {
  String userInfoString = getUserInfoString(fbAuthUserInfoUrl, userInfoFields, token);
  if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_ID_TOKEN)) {
    log.debug("UserInfoString : " + userInfoString);
  }
  Map<String, Object> jsonObject = JSONUtils.parseJSON(userInfoString);
  return jsonObject;
}

代码示例来源:origin: org.everit.authentication/org.everit.authentication.oauth2.ri

private void setParameters(final String contentType, final String body)
  throws OAuthProblemException {
 if (contentType.contains("application/json")) {
  try {
   parameters = JSONUtils.parseJSON(body);
  } catch (Throwable e) {
   throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE,
     "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded");
  }
 } else {
  parameters = OAuthUtils.decodeForm(body);
 }
}

代码示例来源:origin: miltonio/milton2

@Override
protected void setBody(String body) throws OAuthProblemException {
  this.body = body.trim();
  if (isJson()) {
    try {
      parameters = JSONUtils.parseJSON(body);
    } catch (Throwable e) {
      throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded");
    }
  } else {
    parameters = OAuthUtils.decodeForm(body);
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.application.authenticator.social

Map<String, Object> jsonObject = JSONUtils.parseJSON(json);
Map<String, Object> profile = null;
  profile = JSONUtils.parseJSON(jsonObject.entrySet().iterator().next().getValue().toString());

代码示例来源:origin: org.wso2.carbon.identity.outbound.auth.yahoo/org.wso2.carbon.identity.application.authenticator.yahoo

Map<String, Object> jsonObject = JSONUtils.parseJSON(json);
Map<String, Object> profile = null;
  profile = JSONUtils.parseJSON(jsonObject.entrySet().iterator().next().getValue().toString());

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.application.authenticator.oidc

Map<String, Object> jsonObject = JSONUtils.parseJSON(json);

代码示例来源:origin: org.wso2.carbon.identity.outbound.auth.oidc/org.wso2.carbon.identity.application.authenticator.oidc

Map<String, Object> jsonObject = JSONUtils.parseJSON(json);

代码示例来源:origin: org.wso2.carbon.identity.outbound.auth.google/org.wso2.carbon.identity.application.authenticator.google

Map<String, Object> jsonObject = JSONUtils.parseJSON(json);

代码示例来源:origin: org.wso2.carbon.identity.outbound.auth.facebook/org.wso2.carbon.identity.application.authenticator.facebook

protected String getToken(String tokenEndPoint, String clientId, String clientSecret,
            String callbackurl, String code) throws ApplicationAuthenticatorException {
  OAuthClientRequest tokenRequest = null;
  String token = null;
  try {
    tokenRequest =
        buidTokenRequest(tokenEndPoint, clientId, clientSecret, callbackurl,
            code);
    String tokenResponse = sendRequest(tokenRequest.getLocationUri());
    Map<String, Object> jsonObject = JSONUtils.parseJSON(tokenResponse);
    token = (String) jsonObject.get(FacebookAuthenticatorConstants.FB_ACCESS_TOKEN);
    if (StringUtils.isEmpty(token)) {
      throw new ApplicationAuthenticatorException("Could not receive a valid access token from FB");
    }
  } catch (MalformedURLException e) {
    if (log.isDebugEnabled()) {
      log.debug("URL : " + tokenRequest.getLocationUri());
    }
    throw new ApplicationAuthenticatorException(
        "MalformedURLException while sending access token request.",
        e);
  } catch (IOException e) {
    throw new ApplicationAuthenticatorException("IOException while sending access token request.", e);
  }
  return token;
}

代码示例来源:origin: miltonio/milton2

responseMap = JSONUtils.parseJSON(resourceResponseBody);

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.application.authenticator.oidc

String json = new String(decoded);
jsonObject = JSONUtils.parseJSON(json);

相关文章

微信公众号

最新文章

更多

JSONUtils类方法