use of org.codice.ddf.security.handler.pki.CrlChecker in project ddf by codice.
the class CrlInterceptorTest method testErrorThrownWithFailedCert.
/**
* Tests that the interceptor will throw an error if the cert fails the CrlChecker
*/
@Test(expected = AccessDeniedException.class)
public void testErrorThrownWithFailedCert() throws CertificateException {
Message message = createMockMessageWithCert(getTestCertString());
CrlChecker crlChecker = mock(CrlChecker.class);
when(crlChecker.passesCrlCheck(anyObject())).thenReturn(false);
CrlInterceptor crlInterceptor = new CrlInterceptor(crlChecker);
crlInterceptor.handleMessage(message);
verify(crlChecker).passesCrlCheck(getTestCerts());
}
use of org.codice.ddf.security.handler.pki.CrlChecker in project ddf by codice.
the class CrlInterceptorTest method testErrorNotThrownWithPassingCert.
/**
* Tests that the interceptor will NOT throw an error if the cert passes the CrlChecker
*/
@Test
public void testErrorNotThrownWithPassingCert() throws CertificateException {
Message message = createMockMessageWithCert(getTestCertString());
CrlChecker crlChecker = mock(CrlChecker.class);
when(crlChecker.passesCrlCheck(anyObject())).thenReturn(true);
CrlInterceptor crlInterceptor = new CrlInterceptor(crlChecker);
crlInterceptor.handleMessage(message);
verify(crlChecker).passesCrlCheck(getTestCerts());
}
Aggregations