use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class DateValidator method validate.
@Override
public StatusType validate(ValidateRequestType request) {
StatusType status = new StatusType();
List<X509Certificate> certificates = ValidateRequestParser.parse(request);
if (certificates == null || certificates.isEmpty()) {
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INDETERMINATE);
status.getIndeterminateReason().add("http://www.cxf.apache.org/2002/03/xkms#RequestNotSupported");
}
if (isCertificateChainValid(certificates)) {
status.getValidReason().add(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value());
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID);
} else {
status.getInvalidReason().add(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value());
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INVALID);
}
return status;
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class XKMSInvoker method parseValidateXKMSResponse.
protected CertificateValidationResult parseValidateXKMSResponse(ValidateResultType validateResultType, String id) {
XKMSException exception = ExceptionMapper.fromResponse(validateResultType);
if (exception != null) {
throw exception;
}
StatusType status = validateResultType.getKeyBinding().iterator().next().getStatus();
if (KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID != status.getStatusValue()) {
return new CertificateValidationResult(false, XKMS_VALIDATE_ERROR);
}
return new CertificateValidationResult(true, null);
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class DateValidatorTest method validateDateExpired.
@Test
public void validateDateExpired() throws JAXBException {
StatusType result = processRequest("/validateRequestExpired.xml");
Assert.assertEquals(result.getStatusValue(), KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INVALID);
Assert.assertFalse(result.getInvalidReason().isEmpty());
Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value(), result.getInvalidReason().get(0));
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class TrustedAuthorityValidatorTest method testDaveSignedByAliceSginedByRootIsValid.
@Test
public void testDaveSignedByAliceSginedByRootIsValid() throws JAXBException, CertificateException {
StatusType result = processRequest("validateRequestOKDave.xml");
Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
Assert.assertFalse(result.getValidReason().isEmpty());
Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(0));
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class TrustedAuthorityValidatorTest method testAliceSignedByRootIsValid.
@Test
public void testAliceSignedByRootIsValid() throws JAXBException, CertificateException {
StatusType result = processRequest("validateRequestOKAlice.xml");
Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
Assert.assertFalse(result.getValidReason().isEmpty());
Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(0));
}
Aggregations