use of io.gravitee.gateway.security.core.AuthenticationHandler in project gravitee-gateway by gravitee-io.
the class PlanBasedAuthenticationHandlerEnhancerTest method shouldResolveKeylessPolicy_becauseOnePlanKeyless.
@Test
public void shouldResolveKeylessPolicy_becauseOnePlanKeyless() {
AuthenticationHandler authenticationHandler = mock(AuthenticationHandler.class);
when(authenticationHandler.name()).thenReturn("keyless");
Plan plan1 = new Plan();
plan1.setSecurity("keyless");
when(api.getPlans()).thenReturn(Collections.singletonList(plan1));
List<AuthenticationHandler> SecurityProviders = authenticationHandlerEnhancer.filter(Collections.singletonList(authenticationHandler));
assertNotNull(SecurityProviders);
assertFalse(SecurityProviders.isEmpty());
assertEquals("keyless", SecurityProviders.iterator().next().name());
}
use of io.gravitee.gateway.security.core.AuthenticationHandler in project gravitee-gateway by gravitee-io.
the class PlanBasedAuthenticationHandlerEnhancerTest method shouldNotResolveKeylessPolicy_becauseOnePlanApikey.
@Test
public void shouldNotResolveKeylessPolicy_becauseOnePlanApikey() {
AuthenticationHandler authenticationHandler = mock(AuthenticationHandler.class);
when(authenticationHandler.name()).thenReturn("keyless");
Plan plan1 = new Plan();
plan1.setSecurity("apikey");
when(api.getPlans()).thenReturn(Collections.singletonList(plan1));
List<AuthenticationHandler> SecurityProviders = authenticationHandlerEnhancer.filter(Collections.singletonList(authenticationHandler));
assertNotNull(SecurityProviders);
assertTrue(SecurityProviders.isEmpty());
}
use of io.gravitee.gateway.security.core.AuthenticationHandler in project gravitee-gateway by gravitee-io.
the class PlanBasedAuthenticationHandlerEnhancerTest method shouldNotResolveKeylessPolicy_becauseNoPlan.
@Test
public void shouldNotResolveKeylessPolicy_becauseNoPlan() {
AuthenticationHandler authenticationHandler = mock(AuthenticationHandler.class);
when(authenticationHandler.name()).thenReturn("keyless");
List<AuthenticationHandler> SecurityProviders = authenticationHandlerEnhancer.filter(Collections.singletonList(authenticationHandler));
assertNotNull(SecurityProviders);
assertTrue(SecurityProviders.isEmpty());
}
Aggregations