Package org.apache.shindig.gadgets.oauth.OAuthStore

Examples of org.apache.shindig.gadgets.oauth.OAuthStore.TokenInfo


  public void testAccessTokenFromClient() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0));
   
    clientState.setAccessToken("clienttoken");
    clientState.setAccessTokenSecret("clienttokensecret");
    clientState.setSessionHandle("clienthandle");
    clientState.setTokenExpireMillis(56789L);
View Full Code Here


  public void testRequestTokenFromClientState() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0));
   
    clientState.setRequestToken("request");
    clientState.setRequestTokenSecret("requestsecret");
   
    AccessorInfo info = store.getOAuthAccessor(privateToken, arguments, clientState);
View Full Code Here

    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    arguments.setRequestToken("preapproved");
    arguments.setRequestTokenSecret("preapprovedsecret");
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0));
   
    AccessorInfo info = store.getOAuthAccessor(privateToken, arguments, clientState);
    assertNull(info.getAccessor().requestToken);
    assertEquals("access", info.getAccessor().accessToken);
    assertEquals("secret", info.getAccessor().tokenSecret);
View Full Code Here

  public void testRemoveToken() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0));
   
    AccessorInfo info = store.getOAuthAccessor(privateToken, arguments, clientState);
    assertNull(info.getAccessor().requestToken);
    assertEquals("access", info.getAccessor().accessToken);
    assertEquals("secret", info.getAccessor().tokenSecret);
View Full Code Here

    ConsumerInfo consumer = new ConsumerInfo(null, null, null);
    t.setAppUrl("http://localhost:8080/gadgets/oauth.xml");
    t.setViewerId("viewer-one");
    assertNull(store.getTokenInfo(t, consumer, "", ""));

    TokenInfo info = new TokenInfo("token", "secret", null, 0);
    store.setTokenInfo(t, consumer, "service", "token", info);

    info = store.getTokenInfo(t, consumer, "service", "token");
    assertEquals("token", info.getAccessToken());
    assertEquals("secret", info.getTokenSecret());

    FakeGadgetToken t2 = new FakeGadgetToken();
    t2.setAppUrl("http://localhost:8080/gadgets/oauth.xml");
    t2.setViewerId("viewer-two");
    assertNull(store.getTokenInfo(t2, consumer, "service", "token"));
View Full Code Here

  /**
   * Save off our new token and secret to the persistent store.
   */
  private void saveAccessToken() throws OAuthRequestException {
    OAuthAccessor accessor = accessorInfo.getAccessor();
    TokenInfo tokenInfo = new TokenInfo(accessor.accessToken, accessor.tokenSecret,
        accessorInfo.getSessionHandle(), accessorInfo.getTokenExpireMillis());
    fetcherConfig.getTokenStore().storeTokenKeyAndSecret(realRequest.getSecurityToken(),
        accessorInfo.getConsumer(), realRequest.getOAuthArguments(), tokenInfo, responseParams);
  }
View Full Code Here

    BasicOAuthStoreConsumerKeyAndSecret cks = new BasicOAuthStoreConsumerKeyAndSecret("hmac",
        "hmacsecret", KeyType.HMAC_SYMMETRIC, null, null);
    backingStore.setConsumerKeyAndSecret(index, cks);

    backingStore.setTokenInfo(privateToken, null, "testservice", "",
        new TokenInfo("token", "secret", null, 0));

    // Owner views their own page
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.IF_AVAILABLE);
View Full Code Here

  public void testAccessTokenFromServerDatabase() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", "sessionhandle", 12345L), responseParams);

    AccessorInfo info = store.getOAuthAccessor(privateToken, arguments, clientState,
        responseParams, fetcherConfig);
    assertNull(info.getAccessor().requestToken);
    assertEquals("access", info.getAccessor().accessToken);
View Full Code Here

  public void testAccessTokenFromClient() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0), responseParams);

    clientState.setAccessToken("clienttoken");
    clientState.setAccessTokenSecret("clienttokensecret");
    clientState.setSessionHandle("clienthandle");
    clientState.setTokenExpireMillis(56789L);
View Full Code Here

  public void testRequestTokenFromClientState() throws Exception {
    OAuthArguments arguments = new OAuthArguments();
    arguments.setServiceName("testservice");
    arguments.setUseToken(UseToken.ALWAYS);
    store.storeTokenKeyAndSecret(privateToken, null, arguments,
        new TokenInfo("access", "secret", null, 0), responseParams);

    clientState.setRequestToken("request");
    clientState.setRequestTokenSecret("requestsecret");

    AccessorInfo info = store.getOAuthAccessor(privateToken, arguments, clientState,
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.oauth.OAuthStore.TokenInfo

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.