Examples of OAuthResourceResponse


Examples of org.apache.oltu.oauth2.client.response.OAuthResourceResponse

            Long expiresIn = oAuthResponse.getExpiresIn();

            OAuthClientRequest userInfoRequest = new OAuthBearerClientRequest(userInfoUrl)
                    .setAccessToken(accessToken).buildQueryMessage();

            OAuthResourceResponse resourceResponse = oAuthClient.resource(userInfoRequest, OAuth.HttpMethod.GET, OAuthResourceResponse.class);
            String username = resourceResponse.getBody();
            return username;
        } catch (Exception e) {
            e.printStackTrace();
            throw new OAuth2AuthenticationException(e);
        }
View Full Code Here

Examples of org.apache.oltu.oauth2.client.response.OAuthResourceResponse

      .setAccessToken(getAccessToken())
      .buildQueryMessage();
    } catch (OAuthSystemException e1) {
      throw new OAuthException("An error occured while authenticating the user");
    }
    OAuthResourceResponse response;
    try {
      response = oAuthClient.resource(request, OAuth.HttpMethod.GET, OAuthResourceResponse.class);
    } catch (OAuthProblemException e) {
      throw new OAuthException("An error occured while authenticating the user");
    } catch (OAuthSystemException e) {
      throw new OAuthException("An error occured while authenticating the user");
    }
    return response.getBody();
  }
View Full Code Here

Examples of org.apache.oltu.oauth2.client.response.OAuthResourceResponse

 
  public String getValue(final HttpServletRequest request, final String key) {
   
    try {
     
      OAuthResourceResponse userResponse = getUserResponse(request);

      if (userResponse == null) {

        return null;

      }

      String body = userResponse.getBody();
 
      logger.log(Level.INFO, "User response body: {0}", body);
      return (String) JSONUtils.parseJSON(body).get(key);
     
    } catch (Exception ex) {
View Full Code Here

Examples of org.apache.oltu.oauth2.client.response.OAuthResourceResponse

  }

  @Override
  public String getCredential(final HttpServletRequest request) {
   
    OAuthResourceResponse userResponse = getUserResponse(request);
   
    if (userResponse == null) {
     
      return null;
     
    }
   
    String body = userResponse.getBody();
    logger.log(Level.FINE, "User response body: {0}", body);
   
    String[] addresses = StringUtils.stripAll(StringUtils.stripAll(StringUtils.stripEnd(StringUtils.stripStart(body, "["), "]").split(",")), "\"");

    return addresses.length > 0 ? addresses[0] : null;
View Full Code Here

Examples of org.apache.oltu.oauth2.client.response.OAuthResourceResponse

  }

  @Override
  public String getCredential(final HttpServletRequest request) {
   
    OAuthResourceResponse userResponse = getUserResponse(request);
   
    if (userResponse == null) {
     
      return null;
     
    }
   
    String body = userResponse.getBody();
    logger.log(Level.FINE, "User response body: {0}", body);
   
    String[] addresses = StringUtils.stripAll(StringUtils.stripAll(StringUtils.stripEnd(StringUtils.stripStart(body, "["), "]").split(",")), "\"");

    return addresses.length > 0 ? addresses[0] : null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.