Examples of OAuthConsumer


Examples of net.oauth.OAuthConsumer

     
      // get the Request Token to exchange
      OAuthToken requestToken = provider.getRequestToken(consumerKey, requestTokenString);
     
      // build some structures for net.oauth
      OAuthConsumer consumer = new OAuthConsumer(null, consumerKey, requestToken.getConsumer().getSecret(), null);
      OAuthAccessor accessor = new OAuthAccessor(consumer);
      accessor.requestToken = requestTokenString;
      accessor.tokenSecret = requestToken.getSecret();

      // verify the message signature
View Full Code Here

Examples of net.oauth.OAuthConsumer

     method.releaseConnection();
   }

   private String getRequestURL(String consumerKey, String consumerSecret) throws Exception {
     OAuthMessage message = new OAuthMessage("GET", RequestURL, Collections.<Map.Entry>emptyList());
     OAuthConsumer consumer = new OAuthConsumer("http://callback.net", consumerKey, consumerSecret, null);
     OAuthAccessor accessor = new OAuthAccessor(consumer);
     message.addParameter(OAuth.OAUTH_CALLBACK, consumer.callbackURL);
     message.addRequiredParameters(accessor);
     return OAuth.addParameters(message.URL, message.getParameters());
   }
View Full Code Here

Examples of net.oauth.OAuthConsumer

     return OAuth.addParameters(message.URL, message.getParameters());
   }

   private String getAccessURL(String consumerKey, String consumerSecret, String requestKey, String requestSecret, String verifier) throws Exception {
     OAuthMessage message = new OAuthMessage("GET", AccessURL, Collections.<Map.Entry>emptyList());
     OAuthConsumer consumer = new OAuthConsumer("http://callback.net", consumerKey, consumerSecret, null);
     OAuthAccessor accessor = new OAuthAccessor(consumer);
     accessor.requestToken = requestKey;
     accessor.tokenSecret = requestSecret;
     message.addParameter(OAuthUtils.OAUTH_VERIFIER_PARAM, verifier);
     message.addParameter(OAuth.OAUTH_TOKEN, requestKey);
View Full Code Here

Examples of net.oauth.OAuthConsumer

     return OAuth.addParameters(message.URL, message.getParameters());
   }

   private String getProtectedURL(String url, String consumerKey, String consumerSecret, String accessKey, String accessSecret) throws Exception {
     OAuthMessage message = new OAuthMessage("GET", ProtectedURL+url, Collections.<Map.Entry>emptyList());
     OAuthConsumer consumer = new OAuthConsumer("http://callback.net", consumerKey, consumerSecret, null);
     OAuthAccessor accessor = new OAuthAccessor(consumer);
     accessor.accessToken = accessKey;
     accessor.tokenSecret = accessSecret;
     message.addParameter(OAuth.OAUTH_TOKEN, accessKey);
     message.addRequiredParameters(accessor);
View Full Code Here

Examples of net.oauth.OAuthConsumer

                                       Client client,
                                       Token token,
                                       OAuthDataProvider provider,
                                       OAuthValidator validator)
        throws Exception {
        OAuthConsumer consumer = new OAuthConsumer(null, client.getConsumerKey(),
            client.getSecretKey(), null);
        OAuthAccessor accessor = new OAuthAccessor(consumer);
        if (token != null) {
            if (token instanceof RequestToken) {
                accessor.requestToken = token.getTokenKey();
View Full Code Here

Examples of net.oauth.OAuthConsumer

  protected void setUp() throws Exception {
    TokenGenerator tokenGenerator = mock(TokenGenerator.class);
    when(tokenGenerator.generateToken(anyInt())).thenReturn(FAKE_TOKEN);
    container = new DataApiTokenContainer(tokenGenerator);
    OAuthServiceProvider serviceProvider = new OAuthServiceProvider("", "", "");
    consumer = new OAuthConsumer("", "consumerkey", "consumersecret", serviceProvider);
  }
View Full Code Here

Examples of net.oauth.OAuthConsumer

    when(resp.getOutputStream()).thenReturn(outputStream);
    outputWriter = new StringWriter();
    when(resp.getWriter()).thenReturn(new PrintWriter(outputWriter));

    OAuthServiceProvider serviceProvider = new OAuthServiceProvider("", "", "");
    consumer = new OAuthConsumer("", "consumerkey", "consumersecret", serviceProvider);

    servlet =
        new DataApiOAuthServlet(REQUEST_TOKEN_PATH,
            AUTHORIZE_TOKEN_PATH, ACCESS_TOKEN_PATH, GET_ALL_TOKENS_PATH,
            serviceProvider, validator, tokenContainer, sessionManager, tokenGenerator);
View Full Code Here

Examples of net.oauth.OAuthConsumer

    TokenGenerator tokenGenerator = mock(TokenGenerator.class);
    when(tokenGenerator.generateToken(anyInt())).thenReturn(FAKE_TOKEN);
    tokenContainer = new DataApiTokenContainer(tokenGenerator);

    OAuthServiceProvider serviceProvider = new OAuthServiceProvider("", "", "");
    consumer = new OAuthConsumer("", "consumerkey", "consumersecret", serviceProvider);

    req = mock(HttpServletRequest.class);
    when(req.getRequestURL()).thenReturn(new StringBuffer("www.example.com"));
    when(req.getReader()).thenReturn(new BufferedReader(new StringReader("")));
    when(req.getMethod()).thenReturn("POST");
View Full Code Here

Examples of net.oauth.OAuthConsumer

  public FakeOAuthServiceProvider(TimeSource clock) {
    this.clock = clock;
    OAuthServiceProvider provider = new OAuthServiceProvider(
        REQUEST_TOKEN_URL, APPROVAL_URL, ACCESS_TOKEN_URL);

    signedFetchConsumer = new OAuthConsumer(null, null, null, null);
    signedFetchConsumer.setProperty(RSA_SHA1.X509_CERTIFICATE, CERTIFICATE_TEXT);

    oauthConsumer = new OAuthConsumer(null, CONSUMER_KEY, CONSUMER_SECRET, provider);

    tokenState = Maps.newHashMap();
    validParamLocations = Sets.newHashSet();
    validParamLocations.add(OAuthParamLocation.URI_QUERY);
    nonceCache =
View Full Code Here

Examples of net.oauth.OAuthConsumer

  private HttpResponse handleRequestTokenUrl(HttpRequest request)
      throws Exception {
    MessageInfo info = parseMessage(request);
    String requestConsumer = info.message.getParameter(OAuth.OAUTH_CONSUMER_KEY);
    OAuthConsumer consumer;
    if (CONSUMER_KEY.equals(requestConsumer)) {
      consumer = oauthConsumer;
    } else {
      return makeOAuthProblemReport(
          OAuth.Problems.CONSUMER_KEY_UNKNOWN, "invalid consumer: " + requestConsumer,
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.