Package org.eurekastreams.server.persistence.mappers.requests.opensocial

Examples of org.eurekastreams.server.persistence.mappers.requests.opensocial.OAuthTokenRequest


        SecurityToken securityToken = request.getSecurityToken();
        OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(),
                securityToken.getAppUrl()));
        if (consumer != null)
        {
            tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken
                    .getOwnerId()));
        }
        else
        {
            throw new ExecutionException("OAuth Consumer was not found.");
View Full Code Here


    @Test
    public void testFindTokenByServiceNameAndGadgetUrl()
    {
        OAuthConsumer consumer = new OAuthConsumer("provider1", "http://www.example.com/gadget2.xml", "key1",
                "secret1", "HMAC-SHA1");
        OAuthToken token = sut.execute(new OAuthTokenRequest(consumer, "123", "456"));

        assertTrue("No Token found for consumer 101 and viewer 123 and owner 456", token != null);

        // verify loaded attributes of token
        assertEquals("Incorrect access token returned", "accesstoken1", token.getAccessToken());
View Full Code Here

    @Test
    public void testFindNoTokenByServiceNameAndGadgetUrl()
    {
        OAuthConsumer consumer = new OAuthConsumer("provider1", "http://www.example.com/gadget2.xml", "key1",
                "secret1", "HMAC-SHA1");
        OAuthToken token = sut.execute(new OAuthTokenRequest(consumer, "111", "111"));

        assertTrue("Token found for consumer 101 and viewer 111 and owner 111", token == null);
    }
View Full Code Here

    @Test
    public void testExpiredToken()
    {
        OAuthConsumer consumer = new OAuthConsumer("provider4", "http://www.example.com/gadget4.xml", "key4",
                "secret4", "HMAC-SHA1");
        OAuthToken token = sut.execute(new OAuthTokenRequest(consumer, "123", "456"));
        assertTrue("Non-expired Token found for consumer 104 and viewer 123 and owner 456", token == null);
    }
View Full Code Here

    @Test
    public void testDeleteByConsumerAndViewerAndOwner()
    {
        OAuthConsumer consumer = new OAuthConsumer("provider3", "http://www.example.com/gadget4.xml", "key3",
                "secret3", "HMAC-SHA1");
        sut.execute(new OAuthTokenRequest(consumer, "123", "456"));

        Query q = getEntityManager().createQuery(
                "from OAuthToken t where t.consumer.serviceProviderName = :serviceName"
                        + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId")
                .setParameter("serviceName", "provider3").setParameter("gadgetUrl",
View Full Code Here

    @Test
    public void testDeleteNonexistentToken()
    {
        OAuthConsumer consumer = new OAuthConsumer("providerX", "http://www.example.com/gadgetX.xml", "keyX",
                "secretX", "HMAC-SHA1");
        Boolean result = sut.execute(new OAuthTokenRequest(consumer, "X", "Y"));

        Assert.assertEquals(true, result);
    }
View Full Code Here

                securityToken.getAppUrl()));
        if (consumer == null)
        {
            throw new ExecutionException("OAuth Consumer was not found");
        }
        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());
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.persistence.mappers.requests.opensocial.OAuthTokenRequest

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.