Examples of OAuthServletAnswer


Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

    @Test
    @RunAsClient
    public void testUnauthenticatedRequest(@ArquillianResource URL url) throws Exception {
        String response = invokeMethodOnServerUnauthenticated(url, "getEmail");
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        assertEquals("Should NOT be authenticated: " + answer.getReturnVal(), "user is null", answer.getReturnVal());
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

    public void testGetEmailValidScope(@ArquillianResource URL url) throws Exception {
        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String response = invokeMethodOnServer(url, "getEmail", accessToken, SCOPE_USER);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        assertEquals("Should have been authenticated.", nonAdminTestingAccountEmail, answer.getReturnVal());
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String emptyScope = "";
        String response = invokeMethodOnServer(url, "getEmail", accessToken, emptyScope);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        String expectedException = InvalidOAuthTokenException.class.getName();
        assertTrue("Expected: " + expectedException, answer.getReturnVal().startsWith(expectedException));
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String invalidScope = SCOPE_PROFILE;
        String response = invokeMethodOnServer(url, "getEmail", accessToken, invalidScope);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        String expectedException = InvalidOAuthParametersException.class.getName();
        assertTrue("Expected: " + expectedException + ", but was " + answer.getReturnVal(),
            answer.getReturnVal().startsWith(expectedException));
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String multiScope = SCOPE_USER + " " + SCOPE_PROFILE;
        String response = invokeMethodOnServer(url, "getEmail", accessToken, multiScope);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);


        String expectedException = InvalidOAuthParametersException.class.getName();
        assertTrue("Multiple scopes should not match, expected " + expectedException + ", but was " + answer.getReturnVal(),
            answer.getReturnVal().contains(expectedException));
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

    public void testIsUserAdminFalse(@ArquillianResource URL url) throws Exception {
        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String response = invokeMethodOnServer(url, "isUserAdmin", accessToken, SCOPE_USER);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        assertTrue(nonAdminTestingAccountEmail + " should NOT be a valid admin.",
            answer.getReturnVal().equals("false"));
    }
View Full Code Here

Examples of com.google.appengine.tck.oauth.support.OAuthServletAnswer

        String accessToken = getGoogleAccessToken(nonAdminTestingAccountEmail, nonAdminTestingAccountPw,
            oauthClientId, oauthRedirectUri, SCOPE_USER);

        String response = invokeMethodOnServer(url, "getClientId", accessToken, SCOPE_USER);
        OAuthServletAnswer answer = new OAuthServletAnswer(response);

        assertEquals(oauthClientId, answer.getReturnVal());
    }
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.