Search in sources :

Example 1 with HookAuthenticationPolicy

use of io.gravitee.gateway.security.core.HookAuthenticationPolicy 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 HookAuthenticationPolicy

use of io.gravitee.gateway.security.core.HookAuthenticationPolicy 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)2 AuthenticationPolicy (io.gravitee.gateway.security.core.AuthenticationPolicy)2 HookAuthenticationPolicy (io.gravitee.gateway.security.core.HookAuthenticationPolicy)2 PluginAuthenticationPolicy (io.gravitee.gateway.security.core.PluginAuthenticationPolicy)2 Test (org.junit.Test)2