Package org.apache.shindig.social.opensocial.oauth

Examples of org.apache.shindig.social.opensocial.oauth.OAuthEntry


    EasyMock.expect(mockStore.getEntry(EasyMock.eq(TOKEN)))
        .andReturn(authEntry).anyTimes();
  }

  private OAuthEntry createOAuthEntry() {
    OAuthEntry authEntry = new OAuthEntry();
    authEntry.setAppId(APP_ID);
    authEntry.setAuthorized(true);
    authEntry.setConsumerKey(FakeOAuthRequest.CONSUMER_KEY);
    authEntry.setToken(TOKEN);
    authEntry.setTokenSecret(FakeOAuthRequest.CONSUMER_SECRET);
    authEntry.setType(OAuthEntry.Type.ACCESS);
    authEntry.setUserId(FakeOAuthRequest.REQUESTOR);
    authEntry.setIssueTime(new Date());
    authEntry.setDomain(DOMAIN);
    authEntry.setContainer(CONTAINER);
    return authEntry;
  }
View Full Code Here


    verify();
  }

  @Test
  public void testVerifyFailTokenSecretMismatch() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.setTokenSecret("badsecret");
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
    HttpServletRequest request = formEncodedPost.sign(TOKEN,
        FakeOAuthRequest.OAuthParamLocation.URI_QUERY,
View Full Code Here

    verify();
  }

  @Test
  public void testVerifyFailTokenIsRequest() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.setType(OAuthEntry.Type.REQUEST);
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
    HttpServletRequest request = formEncodedPost.sign(TOKEN,
        FakeOAuthRequest.OAuthParamLocation.URI_QUERY,
View Full Code Here

    verify();
  }

  @Test
  public void testVerifyFailTokenIsExpired() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.setIssueTime(new Date(System.currentTimeMillis()
        - (OAuthEntry.ONE_YEAR + 1)));
    authEntry.setType(OAuthEntry.Type.REQUEST);
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
    HttpServletRequest request = formEncodedPost.sign(TOKEN,
        FakeOAuthRequest.OAuthParamLocation.URI_QUERY,
View Full Code Here

        EasyMock.eq(TOKEN))).
          andReturn(authEntry).anyTimes();
  }

  private OAuthEntry createOAuthEntry() {
    OAuthEntry authEntry = new OAuthEntry();
    authEntry.appId = APP_ID;
    authEntry.authorized = true;
    authEntry.consumerKey = FakeOAuthRequest.CONSUMER_KEY;
    authEntry.token = TOKEN;
    authEntry.tokenSecret = FakeOAuthRequest.CONSUMER_SECRET;
View Full Code Here

    verify();
  }

  @Test
  public void testVerifyFailTokenSecretMismatch() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.tokenSecret = "badsecret";
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
    HttpServletRequest request = formEncodedPost.sign(TOKEN,
View Full Code Here

    verify();
  }

  @Test
  public void testVerifyFailTokenIsRequest() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.type = OAuthEntry.Type.REQUEST;
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
    HttpServletRequest request = formEncodedPost.sign(TOKEN,
View Full Code Here

    verify();
  }

  @Test
  public void testVerifyFailTokenIsExpired() throws Exception {
    OAuthEntry authEntry = createOAuthEntry();
    authEntry.issueTime = new Date(System.currentTimeMillis() - (OAuthEntry.ONE_YEAR + 1));
    authEntry.type = OAuthEntry.Type.REQUEST;
    expectTokenEntry(authEntry);
    expectConsumer();
    replay();
View Full Code Here

     * Test successful conversion of access token.
     */
    @Test
    public void testConversion()
    {
        final OAuthEntry requestEntry = new OAuthEntry();
        context.checking(new Expectations()
        {
            {
                oneOf(actionContext).getParams();
                will(returnValue(requestEntry));
View Full Code Here

                oneOf(insertMapper).execute(with(any(PersistenceRequest.class)));
            }
        });

        OAuthEntry results = sut.execute(actionContext);
        assertNotNull(results);
        assertEquals(results.getCallbackUrl(), TEST_CALLBACK_URL);
        assertEquals(results.getConsumerKey(), TEST_CONSUMER_KEY);
        assertEquals(results.getOauthVersion(), TEST_OAUTH_VERSION);
        assertEquals(results.getType(), OAuthEntry.Type.REQUEST);
        assertNotNull(results.getToken());
        assertNotNull(results.getTokenSecret());
        assertEquals(results.getContainer(), TEST_OAUTH_CONTAINER);
        assertEquals(results.getDomain(), TEST_OAUTH_DOMAIN);
        assertEquals(results.getCallbackUrl(), TEST_CALLBACK_URL);
        assertEquals(results.isCallbackUrlSigned(), true);

        context.assertIsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.oauth.OAuthEntry

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.