Package org.brickred.socialauth.exception

Examples of org.brickred.socialauth.exception.SocialAuthException


    Response serviceResponse = null;
    try {
      serviceResponse = authenticationStrategy.executeFeed(url,
          MethodType.PUT.toString(), null, null, msgBody);
    } catch (Exception ie) {
      throw new SocialAuthException("Failed to update status on " + url,
          ie);
    }

    if (serviceResponse.getStatus() != 204) {
      throw new SocialAuthException(
          "Failed to update status. Return status code :"
              + serviceResponse.getStatus());
    }
    LOG.debug("Status Updated and return status code is : "
        + serviceResponse.getStatus());
View Full Code Here


  @Override
  public Response uploadImage(final String message, final String fileName,
      final InputStream inputStream) throws Exception {
    LOG.warn("WARNING: Not implemented for Yahoo");
    throw new SocialAuthException(
        "Upload Image is not implemented for Yahoo");
  }
View Full Code Here

  @Override
  public String getLoginRedirectURL(final String successUrl) throws Exception {
    LOG.info("Determining URL for redirection");
    if (!successUrl.startsWith("https")) {
      throw new SocialAuthException(
          "To implement SalesForce provider your web application should run on a secure port. Please use an https URL instead of http.");
    }
    return authenticationStrategy.getLoginRedirectURL(successUrl);
  }
View Full Code Here

    if (accessGrant != null) {
      LOG.debug("Obtaining user profile");
      return getProfile();
    } else {
      throw new SocialAuthException("Access token not found");
    }

  }
View Full Code Here

   */

  @Override
  public List<Contact> getContactList() throws Exception {
    LOG.warn("WARNING: Not implemented for SalesForce");
    throw new SocialAuthException(
        "Retrieving contacts is not implemented for SalesForce");

  }
View Full Code Here

   */

  @Override
  public Response updateStatus(final String msg) throws Exception {
    LOG.warn("WARNING: Not implemented for SalesForce");
    throw new SocialAuthException(
        "Update Status is not implemented for SalesForce");

  }
View Full Code Here

    try {
      serviceResponse = authenticationStrategy.executeFeed(profileURL,
          MethodType.GET.toString(), null, headerParam, null);
      // HttpUtil.doHttpRequest(profileURL, "GET", null, headerParam);
    } catch (Exception e) {
      throw new SocialAuthException(
          "Failed to retrieve the user profile from  " + profileURL,
          e);
    }

    String result;
    try {
      result = serviceResponse
          .getResponseBodyAsString(Constants.ENCODING);
      LOG.debug("User Profile :" + result);
    } catch (Exception e) {
      throw new SocialAuthException("Failed to read response from  "
          + profileURL, e);
    }
    try {
      JSONObject resp = new JSONObject(result);
      if (resp.has("user_id")) {
        p.setValidatedId(resp.getString("user_id"));
      }
      if (resp.has("first_name")) {
        p.setFirstName(resp.getString("first_name"));
      }
      if (resp.has("last_name")) {
        p.setLastName(resp.getString("last_name"));
      }
      p.setDisplayName(resp.getString("display_name"));

      p.setEmail(resp.getString("email"));
      String locale = resp.getString("locale");
      if (locale != null) {
        String a[] = locale.split("_");
        p.setLanguage(a[0]);
        p.setCountry(a[1]);
      }
      if (resp.has("photos")) {
        JSONObject photosResp = resp.getJSONObject("photos");

        if (p.getProfileImageURL() == null
            || p.getProfileImageURL().length() <= 0) {
          p.setProfileImageURL(photosResp.getString("thumbnail"));
        }
      }
      serviceResponse.close();
      p.setProviderId(getProviderId());
      userProfile = p;
      return p;
    } catch (Exception e) {
      throw new SocialAuthException(
          "Failed to parse the user profile json : " + result, e);

    }
  }
View Full Code Here

    Response response = null;
    try {
      response = authenticationStrategy.executeFeed(url, methodType,
          params, headerParams, body);
    } catch (Exception e) {
      throw new SocialAuthException(
          "Error while making request to URL : " + url, e);
    }
    return response;
  }
View Full Code Here

  @Override
  public Response uploadImage(final String message, final String fileName,
      final InputStream inputStream) throws Exception {
    LOG.warn("WARNING: Not implemented for SalesForce");
    throw new SocialAuthException(
        "Upload Image is not implemented for SalesForce");
  }
View Full Code Here

    if (accessGrant != null) {
      LOG.debug("Access grant available");
      return null;
    } else {
      throw new SocialAuthException("Access token not found");
    }
  }
View Full Code Here

TOP

Related Classes of org.brickred.socialauth.exception.SocialAuthException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.