Examples of OAuthAccessResourceRequest


Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getContentType()).andStubReturn(OAuth.ContentType.JSON);
        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);
        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getContentType()).andStubReturn(OAuth.ContentType.URL_ENCODED);
        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn("HMAC-SHA1");
        replay(request);
        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
            Assert.assertEquals("Incorrect OAuth version. Found OAuth V1.0.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn("Bearer sadfasfd");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY, ParameterStyle.HEADER);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION))
            .andStubReturn("Bearer sadfasfd,oauth_signature_method=\"HMAC-SHA1\"");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY, ParameterStyle.HEADER);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getParameterValues(OAuth.OAUTH_TOKEN)).andStubReturn(null);
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertNotNull(e);
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

                                                                                                 "othertoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
        } catch (OAuthProblemException e) {
            fail("Exception not expected");
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        //        expect(request.getParameterValues(OAuth.OAUTH_TOKEN)).andStubReturn(null);
        //        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertNull(e.getError());
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        //        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        //        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn("HMAC-SHA1");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

Examples of org.apache.amber.oauth2.rs.request.OAuthAccessResourceRequest

        //            .andStubReturn(new String[] {"sometoken", "othertoken"});
        //        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
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.