Examples of OAuthDomainEntry


Examples of org.eurekastreams.server.domain.OAuthDomainEntry

     */
    @Override
    public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        String token = (String) inActionContext.getParams();
        OAuthDomainEntry dto = entryMapper.execute(token);
        return (dto == null) ? null : conversionStrat.convertToEntry(dto);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.OAuthDomainEntry

     * Test finding an entry.
     */
    @Test
    public void testFindEntry()
    {
        OAuthDomainEntry entry = sut.execute("token1");

        assertTrue("No Entry found for token of 'token1'", entry != null);

        // verify loaded attributes of consumer
        assertEquals("Incorrect callback URL returned", "http://localhost:8080/gadgets/oauthcallback", entry
                .getCallbackUrl());
        assertEquals("Incorrect app id returned", "application1", entry.getAppId());
        assertEquals("Incorrect container returned", "container1", entry.getContainer());
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.OAuthDomainEntry

     * Test not finding an entry.
     */
    @Test
    public void testFindNullEntry()
    {
        OAuthDomainEntry entry = sut.execute("tokenX");
        assertTrue("Entry found for token of 'tokenX'", entry == null);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.OAuthDomainEntry

        OAuthEntry tokenEntry = new OAuthEntry();
        tokenEntry.setToken(token);

        try
        {
            OAuthDomainEntry dto = entryMapper.execute(token);
            dto.setAuthorized(true);
            if (dto.isCallbackUrlSigned())
            {
                dto.setCallbackToken(Crypto.getRandomDigits(CALLBACK_TOKEN_LENGTH));
            }
        }
        catch (Exception ex)
        {
            log.error("An error occurred authorizing the OAuth token.", ex);
            throw new ExecutionException(ex);
        }

        OAuthDomainEntry currentEntry = entryMapper.execute(tokenEntry.getToken());
        log.trace("Authorization for user: " + accountId + " complete.");
        String callbackUrl = "";
        if (currentEntry.getCallbackUrl() != null && currentEntry.getCallbackUrl().length() > 0)
        {
            try
            {
                callbackUrl = OAuth.addParameters(currentEntry.getCallbackUrl(), "oauth_verifier", currentEntry
                        .getCallbackToken());
                callbackUrl = OAuth.addParameters(callbackUrl, OAuth.OAUTH_TOKEN, currentEntry.getToken());
            }
            catch (IOException ioe)
            {
                log.error("An IO exception has occured.", ioe);
                throw new ExecutionException(ioe);
View Full Code Here

Examples of org.eurekastreams.server.domain.OAuthDomainEntry

     */
    @Override
    public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        String entryToken = (String) inActionContext.getParams();
        OAuthDomainEntry dto = entryMapper.execute(entryToken);
        dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1);
        if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS)
        {
            dto.setType(OAuthEntry.Type.DISABLED.toString());
        }

        return null;
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.OAuthDomainEntry

     *          the entry to convert.
     * @return the converted entry dto.
     */
    public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry)
    {
        OAuthDomainEntry dto = new OAuthDomainEntry();
        dto.setAppId(entry.getAppId());
        dto.setAuthorized(entry.isAuthorized());
        dto.setCallbackToken(entry.getCallbackToken());
        dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts());
        dto.setCallbackUrl(entry.getCallbackUrl());
        dto.setCallbackUrlSigned(entry.isCallbackUrlSigned());
        dto.setConsumer(mapper.execute(entry.getConsumerKey()));
        dto.setContainer(entry.getContainer());
        dto.setDomain(entry.getDomain());
        dto.setIssueTime(entry.getIssueTime());
        dto.setOauthVersion(entry.getOauthVersion());
        dto.setToken(entry.getToken());
        dto.setTokenSecret(entry.getTokenSecret());
        dto.setType(entry.getType().toString());
        dto.setUserId(entry.getUserId());
        return dto;
    }
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.