Search in sources :

Example 1 with DefaultArgumentExtractor

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

the class Saml10FailureResponseViewTests method setUp.

@Before
public void setUp() throws Exception {
    final Saml10ObjectBuilder builder = new Saml10ObjectBuilder(this.configBean);
    view = new Saml10FailureResponseView(null, null, "attribute", builder, new DefaultArgumentExtractor(new SamlServiceFactory()), StandardCharsets.UTF_8.name(), 0);
}
Also used : DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) SamlServiceFactory(org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory) Saml10ObjectBuilder(org.apereo.cas.support.saml.util.Saml10ObjectBuilder) Before(org.junit.Before)

Example 2 with DefaultArgumentExtractor

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

the class Saml10SuccessResponseViewTests method setUp.

@Before
public void setUp() throws Exception {
    final List<RegisteredService> list = new ArrayList<>();
    list.add(RegisteredServiceTestUtils.getRegisteredService("https://.+"));
    final InMemoryServiceRegistry dao = new InMemoryServiceRegistry();
    dao.setRegisteredServices(list);
    final DefaultServicesManager mgmr = new DefaultServicesManager(dao);
    mgmr.load();
    this.response = new Saml10SuccessResponseView(new DefaultCasProtocolAttributeEncoder(mgmr, NoOpCipherExecutor.getInstance()), mgmr, "attribute", new Saml10ObjectBuilder(configBean), new DefaultArgumentExtractor(new SamlServiceFactory()), StandardCharsets.UTF_8.name(), 1000, "testIssuer", "whatever");
}
Also used : RegisteredService(org.apereo.cas.services.RegisteredService) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) SamlServiceFactory(org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory) ArrayList(java.util.ArrayList) DefaultCasProtocolAttributeEncoder(org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) Saml10ObjectBuilder(org.apereo.cas.support.saml.util.Saml10ObjectBuilder) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) Before(org.junit.Before)

Example 3 with DefaultArgumentExtractor

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

the class SamlServiceTests method verifyTargetMatchesNoSamlService.

@Test
public void verifyTargetMatchesNoSamlService() {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter(SamlProtocolConstants.CONST_PARAM_TARGET, "https://some.service.edu/path/to/app");
    final Service impl = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request);
    final MockHttpServletRequest request2 = new MockHttpServletRequest();
    request2.setParameter(SamlProtocolConstants.CONST_PARAM_TARGET, "https://some.SERVICE.edu");
    final WebApplicationService service = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request2);
    assertFalse(impl.matches(service));
}
Also used : WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

Example 4 with DefaultArgumentExtractor

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

the class SamlServiceTests method verifyTargetMatchesingSamlService.

@Test
public void verifyTargetMatchesingSamlService() {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter(SamlProtocolConstants.CONST_PARAM_TARGET, "https://some.service.edu/path/to/app");
    final WebApplicationService service = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request);
    final Service impl = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request);
    assertTrue(impl.matches(service));
}
Also used : WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

Example 5 with DefaultArgumentExtractor

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

the class WebUtilTests method verifyFoundNoService.

@Test
public void verifyFoundNoService() {
    final DefaultArgumentExtractor casArgumentExtractor = new DefaultArgumentExtractor(new SamlServiceFactory());
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter(CasProtocolConstants.PARAMETER_SERVICE, "test");
    final Service service = WebUtils.getService(Collections.singletonList(casArgumentExtractor), request);
    assertNull(service);
}
Also used : DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) SamlServiceFactory(org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

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