use of org.apereo.cas.pac4j.client.GroovyDelegatedClientIdentityProviderRedirectionStrategy in project cas by apereo.
the class GroovyDelegatedClientIdentityProviderRedirectionStrategyTests method verifyOperation.
@Test
public void verifyOperation() {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
RequestContextHolder.setRequestContext(context);
ExternalContextHolder.setExternalContext(context.getExternalContext());
val provider = DelegatedClientIdentityProviderConfiguration.builder().name("SomeClient").type("CasClient").redirectUrl("https://localhost:8443/redirect").build();
val service = RegisteredServiceTestUtils.getService();
val resource = new ClassPathResource("GroovyClientRedirectStrategy.groovy");
val strategy = new GroovyDelegatedClientIdentityProviderRedirectionStrategy(this.servicesManager, new WatchableGroovyScriptResource(resource));
assertFalse(strategy.getPrimaryDelegatedAuthenticationProvider(context, service, provider).isEmpty());
assertEquals(0, strategy.getOrder());
}
Aggregations