Search in sources :

Example 6 with DefaultArgumentExtractor

use of org.apereo.cas.web.support.DefaultArgumentExtractor in project cas by apereo.

the class WebUtilTests method verifyFindService.

@Test
public void verifyFindService() {
    final DefaultArgumentExtractor casArgumentExtractor = new DefaultArgumentExtractor(new WebApplicationServiceFactory());
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter(CasProtocolConstants.PARAMETER_SERVICE, "test");
    final Service service = WebUtils.getService(Arrays.asList(casArgumentExtractor), request);
    assertNotNull(service);
    assertEquals("test", service.getId());
}
Also used : DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

Example 7 with DefaultArgumentExtractor

use of org.apereo.cas.web.support.DefaultArgumentExtractor in project cas by apereo.

the class InitialFlowSetupActionCookieTests method setUp.

@Before
public void setUp() throws Exception {
    this.warnCookieGenerator = new CookieRetrievingCookieGenerator("warn", "", 2, false, null);
    this.warnCookieGenerator.setCookiePath(StringUtils.EMPTY);
    this.tgtCookieGenerator = new CookieRetrievingCookieGenerator("tgt", "", 2, false, null);
    this.tgtCookieGenerator.setCookiePath(StringUtils.EMPTY);
    final List<ArgumentExtractor> argExtractors = Collections.singletonList(new DefaultArgumentExtractor(new WebApplicationServiceFactory()));
    final ServicesManager servicesManager = mock(ServicesManager.class);
    when(servicesManager.findServiceBy(any(Service.class))).thenReturn(RegisteredServiceTestUtils.getRegisteredService("test"));
    this.action = new InitialFlowSetupAction(argExtractors, servicesManager, tgtCookieGenerator, warnCookieGenerator, casProperties);
    this.action.afterPropertiesSet();
}
Also used : ArgumentExtractor(org.apereo.cas.web.support.ArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) ServicesManager(org.apereo.cas.services.ServicesManager) CookieRetrievingCookieGenerator(org.apereo.cas.web.support.CookieRetrievingCookieGenerator) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) Service(org.apereo.cas.authentication.principal.Service) Before(org.junit.Before)

Aggregations

DefaultArgumentExtractor (org.apereo.cas.web.support.DefaultArgumentExtractor)7 Service (org.apereo.cas.authentication.principal.Service)5 Test (org.junit.Test)4 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)4 SamlServiceFactory (org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory)3 Before (org.junit.Before)3 WebApplicationService (org.apereo.cas.authentication.principal.WebApplicationService)2 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)2 Saml10ObjectBuilder (org.apereo.cas.support.saml.util.Saml10ObjectBuilder)2 ArrayList (java.util.ArrayList)1 DefaultCasProtocolAttributeEncoder (org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder)1 DefaultServicesManager (org.apereo.cas.services.DefaultServicesManager)1 InMemoryServiceRegistry (org.apereo.cas.services.InMemoryServiceRegistry)1 RegisteredService (org.apereo.cas.services.RegisteredService)1 ServicesManager (org.apereo.cas.services.ServicesManager)1 ArgumentExtractor (org.apereo.cas.web.support.ArgumentExtractor)1 CookieRetrievingCookieGenerator (org.apereo.cas.web.support.CookieRetrievingCookieGenerator)1