use of io.gravitee.gateway.security.core.AuthenticationPolicy in project gravitee-gateway by gravitee-io.
the class JWTAuthenticationHandlerTest method shouldReturnPolicies.
@Test
public void shouldReturnPolicies() {
ExecutionContext executionContext = mock(ExecutionContext.class);
List<AuthenticationPolicy> jwtProviderPolicies = authenticationHandler.handle(executionContext);
Assert.assertEquals(2, jwtProviderPolicies.size());
Iterator<AuthenticationPolicy> policyIte = jwtProviderPolicies.iterator();
PluginAuthenticationPolicy policy = (PluginAuthenticationPolicy) policyIte.next();
Assert.assertEquals(JWTAuthenticationHandler.AUTHENTICATION_HANDLER_NAME, policy.name());
HookAuthenticationPolicy policy2 = (HookAuthenticationPolicy) policyIte.next();
Assert.assertEquals(CheckSubscriptionPolicy.class, policy2.clazz());
}
use of io.gravitee.gateway.security.core.AuthenticationPolicy in project gravitee-gateway by gravitee-io.
the class ApiKeyAuthenticationHandlerTest method shouldReturnPolicies.
@Test
public void shouldReturnPolicies() {
ExecutionContext executionContext = mock(ExecutionContext.class);
List<AuthenticationPolicy> apikeyProviderPolicies = authenticationHandler.handle(executionContext);
Assert.assertEquals(1, apikeyProviderPolicies.size());
PluginAuthenticationPolicy policy = (PluginAuthenticationPolicy) apikeyProviderPolicies.iterator().next();
Assert.assertEquals(policy.name(), ApiKeyAuthenticationHandler.API_KEY_POLICY);
}
use of io.gravitee.gateway.security.core.AuthenticationPolicy in project gravitee-gateway by gravitee-io.
the class KeylessAuthenticationHandlerTest method shouldReturnPolicies.
@Test
public void shouldReturnPolicies() {
ExecutionContext executionContext = mock(ExecutionContext.class);
List<AuthenticationPolicy> keylessProviderPolicies = authenticationHandler.handle(executionContext);
Assert.assertEquals(1, keylessProviderPolicies.size());
PluginAuthenticationPolicy policy = (PluginAuthenticationPolicy) keylessProviderPolicies.iterator().next();
Assert.assertEquals(policy.name(), KeylessAuthenticationHandler.KEYLESS_POLICY);
}
use of io.gravitee.gateway.security.core.AuthenticationPolicy in project gravitee-gateway by gravitee-io.
the class OAuth2AuthenticationHandlerTest method shouldReturnPolicies.
@Test
public void shouldReturnPolicies() {
ExecutionContext executionContext = mock(ExecutionContext.class);
List<AuthenticationPolicy> oauth2ProviderPolicies = authenticationHandler.handle(executionContext);
Assert.assertEquals(2, oauth2ProviderPolicies.size());
Iterator<AuthenticationPolicy> policyIte = oauth2ProviderPolicies.iterator();
PluginAuthenticationPolicy policy = (PluginAuthenticationPolicy) policyIte.next();
Assert.assertEquals(OAuth2AuthenticationHandler.AUTHENTICATION_HANDLER_NAME, policy.name());
HookAuthenticationPolicy policy2 = (HookAuthenticationPolicy) policyIte.next();
Assert.assertEquals(CheckSubscriptionPolicy.class, policy2.clazz());
}
Aggregations