use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class XKMSService method validate.
@Override
public ValidateResultType validate(ValidateRequestType request) {
ValidateResultType response = XKMSResponseFactory.createResponse(request, new ValidateResultType());
try {
validateRequest(request);
// Create basic response
KeyBindingType binding = createKeyBinding(response);
// Validate request
for (Validator validator : validators) {
StatusType status = validator.validate(request);
addValidationReasons(binding, status);
}
resolveValidationStatus(binding);
return response;
} catch (Exception e) {
return handleException("recover", e, response);
}
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class XKMSService method createKeyBinding.
// TODO refactoring into factory class?
public static KeyBindingType createKeyBinding(ValidateResultType result) {
KeyBindingType binding = new KeyBindingType();
binding.setId(XKMSResponseFactory.generateUniqueID());
result.getKeyBinding().add(binding);
StatusType status = new StatusType();
binding.setStatus(status);
return binding;
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class XKMSService method resolveValidationStatus.
/**
* http://www.w3.org/TR/xkms2/#XKMS_2_0_Section_4_1 [206]
*
* If no (or indeterminate) reasons are present total status is INDETERMINATE.
* If no invalid and indeterminate reasons are present status is VALID.
* If invalid reasons are present status is INVALID.
*
* @param binding KeyBinding to check validation reasons for
*/
private void resolveValidationStatus(KeyBindingType binding) {
StatusType status = binding.getStatus();
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INDETERMINATE);
if (!status.getValidReason().isEmpty() && status.getIndeterminateReason().isEmpty()) {
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID);
}
if (!status.getInvalidReason().isEmpty()) {
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INVALID);
// Only return invalid reasons
status.getValidReason().clear();
}
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class XKMSService method addValidationReasons.
private void addValidationReasons(KeyBindingType binding, StatusType status) {
StatusType resultStatus = binding.getStatus();
resultStatus.getValidReason().addAll(status.getValidReason());
resultStatus.getInvalidReason().addAll(status.getInvalidReason());
resultStatus.getIndeterminateReason().addAll(status.getIndeterminateReason());
}
use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.
the class X509Register method prepareResponseBinding.
private KeyBindingType prepareResponseBinding(PrototypeKeyBindingType binding) {
KeyBindingType responseBinding = new KeyBindingType();
responseBinding.setKeyInfo(binding.getKeyInfo());
StatusType status = new StatusType();
status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID);
responseBinding.setStatus(status);
return responseBinding;
}
Aggregations