Search in sources :

Example 1 with DefaultSingleLogoutServiceMessageHandler

use of org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler in project cas by apereo.

the class DefaultLogoutManagerTests method initialize.

@BeforeEach
public void initialize() {
    tgt = new MockTicketGrantingTicket("casuser");
    when(client.isValidEndPoint(any(String.class))).thenReturn(true);
    when(client.isValidEndPoint(any(URL.class))).thenReturn(true);
    when(client.sendMessageToEndPoint(any(HttpMessage.class))).thenReturn(true);
    val validator = new SimpleUrlValidatorFactoryBean(true).getObject();
    singleLogoutServiceMessageHandler = new DefaultSingleLogoutServiceMessageHandler(client, new DefaultSingleLogoutMessageCreator(), servicesManager, new DefaultSingleLogoutServiceLogoutUrlBuilder(servicesManager, validator), true, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
    this.simpleWebApplicationServiceImpl = getService(URL);
    tgt.getServices().put(ID, this.simpleWebApplicationServiceImpl);
    val plan = new DefaultLogoutExecutionPlan();
    plan.registerSingleLogoutServiceMessageHandler(singleLogoutServiceMessageHandler);
    this.logoutManager = new DefaultLogoutManager(false, plan);
    this.registeredService = getRegisteredService(URL);
    when(servicesManager.findServiceBy(this.simpleWebApplicationServiceImpl)).thenReturn(this.registeredService);
    assertTrue(plan.getLogoutRedirectionStrategies().isEmpty());
}
Also used : lombok.val(lombok.val) DefaultAuthenticationServiceSelectionStrategy(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy) DefaultSingleLogoutServiceMessageHandler(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler) DefaultSingleLogoutServiceLogoutUrlBuilder(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceLogoutUrlBuilder) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) URL(java.net.URL) MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) SimpleUrlValidatorFactoryBean(org.apereo.cas.web.SimpleUrlValidatorFactoryBean) HttpMessage(org.apereo.cas.util.http.HttpMessage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with DefaultSingleLogoutServiceMessageHandler

use of org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler in project cas by apereo.

the class DefaultSingleLogoutServiceMessageHandlerTests method verifyEmpty.

@Test
public void verifyEmpty() {
    val servicesManager = mock(ServicesManager.class);
    val service = new RegexRegisteredService();
    service.setServiceId(UUID.randomUUID().toString());
    when(servicesManager.findServiceBy(any(Service.class))).thenReturn(service);
    val handler = new DefaultSingleLogoutServiceMessageHandler(new SimpleHttpClientFactoryBean().getObject(), new DefaultSingleLogoutMessageCreator(), servicesManager, new DefaultSingleLogoutServiceLogoutUrlBuilder(servicesManager, mock(UrlValidator.class)), false, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
    assertTrue(handler.handle(CoreAuthenticationTestUtils.getWebApplicationService(), UUID.randomUUID().toString(), SingleLogoutExecutionRequest.builder().build()).isEmpty());
}
Also used : lombok.val(lombok.val) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) DefaultAuthenticationServiceSelectionStrategy(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy) DefaultSingleLogoutServiceMessageHandler(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler) DefaultSingleLogoutServiceLogoutUrlBuilder(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceLogoutUrlBuilder) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) Service(org.apereo.cas.authentication.principal.Service) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)2 DefaultAuthenticationServiceSelectionPlan (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan)2 DefaultAuthenticationServiceSelectionStrategy (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy)2 DefaultSingleLogoutServiceLogoutUrlBuilder (org.apereo.cas.logout.slo.DefaultSingleLogoutServiceLogoutUrlBuilder)2 DefaultSingleLogoutServiceMessageHandler (org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler)2 URL (java.net.URL)1 Service (org.apereo.cas.authentication.principal.Service)1 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)1 RegexRegisteredService (org.apereo.cas.services.RegexRegisteredService)1 HttpMessage (org.apereo.cas.util.http.HttpMessage)1 SimpleHttpClientFactoryBean (org.apereo.cas.util.http.SimpleHttpClientFactoryBean)1 SimpleUrlValidatorFactoryBean (org.apereo.cas.web.SimpleUrlValidatorFactoryBean)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1