Search in sources :

Example 6 with FF4jAuthenticationFilter

use of org.ff4j.web.api.security.FF4jAuthenticationFilter in project ff4j by ff4j.

the class SecurityAuthenticationFilterTest method testNoAuthorizationAttributeInHeader.

@Test(expected = WebApplicationException.class)
public void testNoAuthorizationAttributeInHeader() throws IOException {
    // Given
    FF4jAuthenticationFilter faf = new FF4jAuthenticationFilter();
    ContainerRequestContext mockRequest = mock(ContainerRequestContext.class);
    when(mockRequest.getHeaderString("Authorization")).thenReturn(null);
    when(mockRequest.getMethod()).thenReturn("GET");
    UriInfo mockUriInfo = mock(UriInfo.class);
    when(mockUriInfo.getPath()).thenReturn("someURL");
    when(mockRequest.getUriInfo()).thenReturn(mockUriInfo);
    faf.filter(mockRequest);
}
Also used : ContainerRequestContext(javax.ws.rs.container.ContainerRequestContext) FF4jAuthenticationFilter(org.ff4j.web.api.security.FF4jAuthenticationFilter) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test)

Aggregations

ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)6 UriInfo (javax.ws.rs.core.UriInfo)6 FF4jAuthenticationFilter (org.ff4j.web.api.security.FF4jAuthenticationFilter)6 Test (org.junit.Test)6 ApiConfig (org.ff4j.web.ApiConfig)2