Examples of performAllValidations()


Examples of org.apache.amber.oauth2.as.validator.TokenValidator.performAllValidations()

        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn("client_id");

        replay(request);

        TokenValidator validator = new TokenValidator();
        validator.performAllValidations(request);
        verify(request);
    }
}
View Full Code Here

Examples of org.apache.amber.oauth2.rs.validator.BearerHeaderOAuthValidator.performAllValidations()

        HttpServletRequest request = createMock(HttpServletRequest.class);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn(null);
        replay(request);
        try {
            BearerHeaderOAuthValidator bov = new BearerHeaderOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            org.junit.Assert.assertTrue(OAuthUtils.isEmpty(e.getError()));
            Assert.assertEquals("Missing authorization header.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.amber.oauth2.rs.validator.BearerHeaderOAuthValidator.performAllValidations()

        HttpServletRequest request = createMock(HttpServletRequest.class);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn("Basic arawersadf");
        replay(request);
        try {
            BearerHeaderOAuthValidator bov = new BearerHeaderOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            org.junit.Assert.assertTrue(OAuthUtils.isEmpty(e.getError()));
            Assert.assertEquals("Incorrect authorization method.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.amber.oauth2.rs.validator.BearerHeaderOAuthValidator.performAllValidations()

        HttpServletRequest request = createMock(HttpServletRequest.class);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn("Bearer  ");
        replay(request);
        try {
            BearerHeaderOAuthValidator bov = new BearerHeaderOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
            Assert.assertEquals("Missing required parameter.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.amber.oauth2.rs.validator.BearerHeaderOAuthValidator.performAllValidations()

        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION))
            .andStubReturn("Bearer sdfsadfsadf,oauth_signature_method=\"HMAC-SHA1\"");
        replay(request);
        try {
            BearerHeaderOAuthValidator bov = new BearerHeaderOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
            Assert.assertEquals("Incorrect OAuth version. Found OAuth V1.0.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.amber.oauth2.rs.validator.BearerHeaderOAuthValidator.performAllValidations()

        HttpServletRequest request = createMock(HttpServletRequest.class);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn("Bearer sdfsadfsadf");
        replay(request);
        BearerHeaderOAuthValidator bov = new BearerHeaderOAuthValidator();
        bov.performAllValidations(request);

        verify(request);
    }

}
View Full Code Here

Examples of org.apache.oltu.oauth2.as.validator.TokenValidator.performAllValidations()

        expect(request.getParameter(OAuth.OAUTH_CLIENT_ID)).andStubReturn("client_id");

        replay(request);

        TokenValidator validator = new TokenValidator();
        validator.performAllValidations(request);
        verify(request);
    }
}
View Full Code Here

Examples of org.apache.oltu.oauth2.rs.validator.BearerBodyOAuthValidator.performAllValidations()

        expect(request.getMethod()).andStubReturn("GET");
        expect(request.getContentType()).andStubReturn(OAuth.ContentType.URL_ENCODED);
        replay(request);
        try {
            BearerBodyOAuthValidator bov = new BearerBodyOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
            Assert.assertEquals("Incorrect method. POST, PUT, DELETE are supported.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.oltu.oauth2.rs.validator.BearerBodyOAuthValidator.performAllValidations()

        expect(request.getMethod()).andStubReturn(OAuth.HttpMethod.POST);
        expect(request.getContentType()).andStubReturn("multipart/form-data");
        replay(request);
        try {
            BearerBodyOAuthValidator bov = new BearerBodyOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.CodeResponse.INVALID_REQUEST, e.getError());
            Assert.assertEquals("Request is not single part.", e.getDescription());
        }
View Full Code Here

Examples of org.apache.oltu.oauth2.rs.validator.BearerBodyOAuthValidator.performAllValidations()

        expect(request.getMethod()).andStubReturn(OAuth.HttpMethod.POST);
        expect(request.getContentType()).andStubReturn(OAuth.ContentType.JSON);
        replay(request);
        try {
            BearerBodyOAuthValidator bov = new BearerBodyOAuthValidator();
            bov.performAllValidations(request);
            Assert.fail("Exception not thrown.");
        } catch (OAuthProblemException e) {
            Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, e.getError());
            Assert.assertEquals("Bad request content type. Expecting: application/x-www-form-urlencoded", e.getDescription());
        }
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.