use of org.codice.ddf.platform.session.api.HttpSessionInvalidator in project ddf by codice.
the class LogoutRequestServiceTest method testSoapLogoutRequestBadSignature.
@Test
public void testSoapLogoutRequestBadSignature() throws Exception {
HttpSessionInvalidator httpSessionInvalidator = mock(HttpSessionInvalidator.class);
logoutRequestService.setHttpSessionInvalidator(httpSessionInvalidator);
LogoutResponse logoutResponse = mock(LogoutResponse.class);
LogoutWrapper logoutResponseWrapper = mock(LogoutWrapper.class);
doReturn(logoutResponse).when(logoutResponseWrapper).getMessage();
doReturn(logoutResponseWrapper).when(logoutMessage).buildLogoutResponse(anyString(), anyString(), anyString());
logoutRequestService.setLogoutMessage(logoutMessage);
doThrow(SignatureException.class).when(simpleSign).validateSignature(any(Signature.class), any(Document.class));
InputStream requestStream = LogoutRequestServiceTest.class.getResourceAsStream("/SAMLSoapLogoutRequest-good.xml");
Response response = logoutRequestService.soapLogoutRequest(requestStream, null);
assertThat(response.getStatus(), is(Status.OK.getStatusCode()));
verify(httpSessionInvalidator, times(0)).invalidateSession(anyString(), any());
}
use of org.codice.ddf.platform.session.api.HttpSessionInvalidator in project ddf by codice.
the class LogoutRequestServiceTest method testSoapLogoutRequestIssueInstantOld.
@Test
public void testSoapLogoutRequestIssueInstantOld() {
HttpSessionInvalidator httpSessionInvalidator = mock(HttpSessionInvalidator.class);
logoutRequestService.setHttpSessionInvalidator(httpSessionInvalidator);
logoutRequestService.setLogoutMessage(logoutMessage);
InputStream requestStream = LogoutRequestServiceTest.class.getResourceAsStream("/SAMLSoapLogoutRequest-good.xml");
Response response = logoutRequestService.soapLogoutRequest(requestStream, null);
assertThat(response.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
verify(httpSessionInvalidator, times(0)).invalidateSession(anyString(), any());
}
use of org.codice.ddf.platform.session.api.HttpSessionInvalidator in project ddf by codice.
the class LogoutRequestServiceTest method testSoapLogoutRequestNotALogout.
@Test
public void testSoapLogoutRequestNotALogout() {
HttpSessionInvalidator httpSessionInvalidator = mock(HttpSessionInvalidator.class);
logoutRequestService.setHttpSessionInvalidator(httpSessionInvalidator);
logoutRequestService.setLogoutMessage(logoutMessage);
InputStream requestStream = LogoutRequestServiceTest.class.getResourceAsStream("/SAMLSoapLogoutRequest-bad.xml");
Response response = logoutRequestService.soapLogoutRequest(requestStream, null);
assertThat(response.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
verify(httpSessionInvalidator, times(0)).invalidateSession(anyString(), any());
}
Aggregations