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());
}
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());
}
Aggregations