use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class JWTAuthenticationHandlerTest method shouldHandleRequest_validAuthorizationHeader.
@Test
public void shouldHandleRequest_validAuthorizationHeader() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, JWTAuthenticationHandler.BEARER_AUTHORIZATION_TYPE + " xxx-xx-xxx-xx-xx");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertTrue(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class JWTAuthenticationHandlerTest method shouldNotHandleRequest_noBearerValue.
@Test
public void shouldNotHandleRequest_noBearerValue() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, JWTAuthenticationHandler.BEARER_AUTHORIZATION_TYPE + " ");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertFalse(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class JWTAuthenticationHandlerTest method shouldNotHandleRequest_invalidAuthorizationHeader.
@Test
public void shouldNotHandleRequest_invalidAuthorizationHeader() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, "");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertFalse(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class KeylessAuthenticationHandlerTest method shouldHandleRequest.
@Test
public void shouldHandleRequest() {
Request request = mock(Request.class);
when(request.headers()).thenReturn(new HttpHeaders());
boolean handle = authenticationHandler.canHandle(request);
Assert.assertTrue(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class OAuth2AuthenticationHandlerTest method shouldHandleRequest_validAuthorizationHeader.
@Test
public void shouldHandleRequest_validAuthorizationHeader() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, OAuth2AuthenticationHandler.BEARER_AUTHORIZATION_TYPE + " xxx-xx-xxx-xx-xx");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertTrue(handle);
}
Aggregations