use of org.apereo.cas.configuration.model.support.interrupt.RestfulInterruptProperties in project cas by apereo.
the class RestEndpointInterruptInquirerTests method verifyResponseCanBeFoundFromRest.
@Test
public void verifyResponseCanBeFoundFromRest() {
val restProps = new RestfulInterruptProperties();
restProps.setUrl("http://localhost:8888");
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
request.addHeader("accept-language", "fr");
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
val q = new RestEndpointInterruptInquirer(restProps);
val response = q.inquire(CoreAuthenticationTestUtils.getAuthentication("casuser"), CoreAuthenticationTestUtils.getRegisteredService(), CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword(), context);
assertNotNull(response);
assertTrue(response.isBlock());
assertTrue(response.isSsoEnabled());
assertEquals(2, response.getLinks().size());
assertEquals(getClass().getSimpleName(), response.getMessage());
}
use of org.apereo.cas.configuration.model.support.interrupt.RestfulInterruptProperties in project cas by apereo.
the class RestEndpointInterruptInquirerTests method verifyBadAttempt.
@Test
public void verifyBadAttempt() {
val restProps = new RestfulInterruptProperties();
restProps.setUrl("http://localhost:8888");
val context = new MockRequestContext();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
val q = new RestEndpointInterruptInquirer(restProps);
val response = q.inquire(null, CoreAuthenticationTestUtils.getRegisteredService(), CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword(), context);
assertFalse(response.isInterrupt());
}
Aggregations