Examples of OAuthRequest


Examples of org.agorava.api.oauth.OAuthRequest

    public Token getRequestToken(RequestTuner tuner) {

        OAuthAppSettings config = getTunedOAuthAppSettings();
        LOGGER.fine("obtaining request token from " + api.getRequestTokenEndpoint());
        OAuthRequest request = requestFactory(api.getRequestTokenVerb(), api.getRequestTokenEndpoint());

        LOGGER.fine("setting oauth_callback to " + config.getCallback());
        request.addOAuthParameter(AgoravaConstants.CALLBACK, config.getCallback());
        addOAuthParams(request, AgoravaConstants.EMPTY_TOKEN);
        appendSignature(request);

        LOGGER.fine("sending request...");
        Response response = request.send(tuner);
        //todo:should check return code and launch ResponseException if it's not 200
        String body = response.getBody();

        LOGGER.fine("response status code: " + response.getCode());
        LOGGER.fine("response body: " + body);
View Full Code Here

Examples of org.apache.amber.oauth2.as.request.OAuthRequest

        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn("test_client");
        expect(request.getParameter(OAuth.OAUTH_REDIRECT_URI)).andStubReturn("http://example.com/callback");
        replay(request);

        OAuthRequest req = null;
        try {
            new OAuthAuthzRequest(request);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
View Full Code Here

Examples of org.apache.amber.oauth2.as.request.OAuthRequest

        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn(null);
        expect(request.getParameter(OAuth.OAUTH_REDIRECT_URI)).andStubReturn("http://example.com/callback");
        replay(request);

        OAuthRequest req = null;
        try {
            new OAuthAuthzRequest(request);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
View Full Code Here

Examples of org.apache.amber.oauth2.as.request.OAuthRequest

        expect(request.getContentType()).andStubReturn(OAuth.ContentType.URL_ENCODED);
        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn("test_client");
        expect(request.getParameter(OAuth.OAUTH_REDIRECT_URI)).andStubReturn("http://example.com/callback");
        replay(request);

        OAuthRequest req = null;
        try {
            new OAuthAuthzRequest(request);
        } catch (OAuthProblemException e) {
            fail("Exception not expected");
        }
View Full Code Here

Examples of org.apache.amber.oauth2.as.request.OAuthRequest

        expect(request.getParameter(OAuth.OAUTH_GRANT_TYPE)).andStubReturn(OAuth.ContentType.URL_ENCODED);
        expect(request.getParameter(OAuth.OAUTH_REDIRECT_URI)).andStubReturn("http://www.example.com/red");
        expect(request.getParameter("param")).andStubReturn("someparam");
        replay(request);

        OAuthRequest req = null;
        try {
            req = new OAuthTokenRequest(request);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
View Full Code Here

Examples of org.apache.amber.oauth2.as.request.OAuthRequest

        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn("test_client");
        expect(request.getParameter(OAuth.OAUTH_REDIRECT_URI)).andStubReturn("http://example.com/callback");
        expect(request.getParameter(OAuth.OAUTH_SCOPE)).andStubReturn("album photo");
        replay(request);

        OAuthRequest req = null;
        try {
            req = new OAuthAuthzRequest(request);
        } catch (OAuthProblemException e) {
            fail("Exception not expected");
        }

        Set<String> scopes = req.getScopes();

        Assert.assertTrue(findScope(scopes, "album"));
        Assert.assertTrue(findScope(scopes, "photo"));

        verify(request);
View Full Code Here

Examples of org.apache.oltu.oauth2.as.request.OAuthRequest

                .expectRedirectUri(REDIRECT_URI)
                .expectScopes("album photo")
                .build();
        replay(request);

        OAuthRequest req = null;
        try {
            req = new OAuthAuthzRequest(request);
        } catch (OAuthProblemException e) {
            fail("Exception not expected");
        }

        Set<String> scopes = req.getScopes();

        Assert.assertTrue(findScope(scopes, "album"));
        Assert.assertTrue(findScope(scopes, "photo"));

        verify(request);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthRequest

    if (trustedParams != null) {
      List<Parameter> trusted = Lists.newArrayList();
      for (Entry<String, String> e : trustedParams.entrySet()) {
        trusted.add(new Parameter(e.getKey(), e.getValue()));
      }
      return new OAuthRequest(fetcherConfig, dest, trusted);
    }
    return new OAuthRequest(fetcherConfig, dest);
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthRequest

   * Send an OAuth GET request to the given URL.
   */
  public HttpResponse sendGet(String target) throws Exception {
    HttpRequest request = new HttpRequest(Uri.parse(target));
    request.setOAuthArguments(recallState());
    OAuthRequest dest = createRequest();
    request.setIgnoreCache(ignoreCache);
    request.setSecurityToken(securityToken);
    HttpResponse response = dest.fetch(request);
    saveState(response);
    return response;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthRequest

  // Yes, this is really allowed by the HTTP spec and supported by real servers.
  public HttpResponse sendGetWithBody(String target, String type, byte[] body) {
    HttpRequest request = new HttpRequest(Uri.parse(target));
    request.setOAuthArguments(recallState());
    OAuthRequest dest = createRequest();
    if (type != null) {
      request.setHeader("Content-Type", type);
    }
    request.setPostBody(body);
    request.setSecurityToken(securityToken);
    HttpResponse response = dest.fetch(request);
    saveState(response);
    return response;
  }
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.