Search in sources :

Example 1 with PluginAuthenticationPolicy

use of io.gravitee.gateway.security.core.PluginAuthenticationPolicy 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());
}
Also used : ExecutionContext(io.gravitee.gateway.api.ExecutionContext) AuthenticationPolicy(io.gravitee.gateway.security.core.AuthenticationPolicy) HookAuthenticationPolicy(io.gravitee.gateway.security.core.HookAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) HookAuthenticationPolicy(io.gravitee.gateway.security.core.HookAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) Test(org.junit.Test)

Example 2 with PluginAuthenticationPolicy

use of io.gravitee.gateway.security.core.PluginAuthenticationPolicy 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);
}
Also used : ExecutionContext(io.gravitee.gateway.api.ExecutionContext) AuthenticationPolicy(io.gravitee.gateway.security.core.AuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) Test(org.junit.Test)

Example 3 with PluginAuthenticationPolicy

use of io.gravitee.gateway.security.core.PluginAuthenticationPolicy 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);
}
Also used : ExecutionContext(io.gravitee.gateway.api.ExecutionContext) AuthenticationPolicy(io.gravitee.gateway.security.core.AuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) Test(org.junit.Test)

Example 4 with PluginAuthenticationPolicy

use of io.gravitee.gateway.security.core.PluginAuthenticationPolicy 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());
}
Also used : ExecutionContext(io.gravitee.gateway.api.ExecutionContext) AuthenticationPolicy(io.gravitee.gateway.security.core.AuthenticationPolicy) HookAuthenticationPolicy(io.gravitee.gateway.security.core.HookAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) HookAuthenticationPolicy(io.gravitee.gateway.security.core.HookAuthenticationPolicy) PluginAuthenticationPolicy(io.gravitee.gateway.security.core.PluginAuthenticationPolicy) Test(org.junit.Test)

Aggregations

ExecutionContext (io.gravitee.gateway.api.ExecutionContext)4 AuthenticationPolicy (io.gravitee.gateway.security.core.AuthenticationPolicy)4 PluginAuthenticationPolicy (io.gravitee.gateway.security.core.PluginAuthenticationPolicy)4 Test (org.junit.Test)4 HookAuthenticationPolicy (io.gravitee.gateway.security.core.HookAuthenticationPolicy)2