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

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


    public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        SetConsumerTokenInfoRequest request = (SetConsumerTokenInfoRequest) inActionContext.getParams();

        SecurityToken securityToken = request.getSecurityToken();
        TokenInfo tokenInfo = request.getTokenInfo();

        OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(),
                securityToken.getAppUrl()));
        if (consumer != null)
        {
            OAuthToken token = new OAuthToken(consumer, securityToken.getViewerId(), securityToken.getOwnerId(),
                    tokenInfo.getAccessToken(), tokenInfo.getTokenSecret());
            token.setTokenExpireMillis(tokenInfo.getTokenExpireMillis());
            tokenInsertMapper.execute(new PersistenceRequest<OAuthToken>(token));
        }
        else
        {
            throw new ExecutionException("OAuth Consumer was not found");
View Full Code Here


        }
        OAuthToken token = tokenMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(),
                securityToken.getOwnerId()));
        if (token != null)
        {
            TokenInfo tokenInfo = new TokenInfo(token.getAccessToken(), token.getTokenSecret(), null, token
                    .getTokenExpireMillis());
            return new TokenInfoResponse(tokenInfo);
        }
        return null;
    }
View Full Code Here

    store.getConsumerKeyAndSecret(createMock(SecurityToken.class), "service4", createMock(OAuthServiceProvider.class));
  }

  @Test
  public void testGetAndSetTokenInfo() throws Exception {
    TokenInfo info = new TokenInfo("accessToken1", "tokenSecret1", "sessionHandle1", 1000L);
    SecurityToken st = createSecurityTokenMock("viewer1");
    store.setTokenInfo(st, createMock(ConsumerInfo.class), "service1", "token1", info);
    assertEquals(info, store.getTokenInfo(st, createMock(ConsumerInfo.class), "service1", "token1"));
    assertNull(store.getTokenInfo(st, createMock(ConsumerInfo.class), "service2", "token2"));
  }
View Full Code Here

    assertNull(store.getTokenInfo(st, createMock(ConsumerInfo.class), "service2", "token2"));
  }

  @Test
  public void testRemoveToken() throws Exception {
    TokenInfo info = new TokenInfo("accessToken1", "tokenSecret1", "sessionHandle1", 1000L);
    SecurityToken st = createSecurityTokenMock("viewer1");
    store.setTokenInfo(st, createMock(ConsumerInfo.class), "service1", "token1", info);
    assertEquals(info, store.getTokenInfo(st, createMock(ConsumerInfo.class), "service1", "token1"));
    store.removeToken(st, createMock(ConsumerInfo.class), "service1", "token1");
    assertNull(store.getTokenInfo(st, createMock(ConsumerInfo.class), "service1", "token1"));
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.