use of org.apache.cxf.xkms.model.xkms.LocateResultType in project cxf by apache.
the class XKMSService method locate.
@Override
public LocateResultType locate(LocateRequestType request) {
LocateResultType response = XKMSResponseFactory.createResponse(request, new LocateResultType());
try {
validateRequest(request);
// Search
for (Locator locator : locators) {
UnverifiedKeyBindingType keyBinding = locator.locate(request);
if (keyBinding != null) {
response.getUnverifiedKeyBinding().add(keyBinding);
return response;
}
}
// No matches found
response.setResultMinor(ResultMinorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_NO_MATCH.value());
return response;
} catch (Exception e) {
return handleException("locate", e, response);
}
}
use of org.apache.cxf.xkms.model.xkms.LocateResultType in project cxf by apache.
the class X509Utils method createResponse.
LocateResultType createResponse(LocateRequestType request) {
LocateResultType ret = new LocateResultType();
ret.setId(UUID.randomUUID().toString());
ret.setRequestId(request.getId());
ret.setService("http://services.sopera.org/xkms/v2.0");
return ret;
}
use of org.apache.cxf.xkms.model.xkms.LocateResultType in project cxf by apache.
the class XKMSInvoker method getCertificate.
public X509Certificate getCertificate(List<X509AppId> ids) {
try {
LocateRequestType locateRequestType = prepareLocateXKMSRequest(ids);
LocateResultType locateResultType = xkmsConsumer.locate(locateRequestType);
return parseLocateXKMSResponse(locateResultType, ids);
} catch (RuntimeException e) {
String msg = String.format("XKMS locate call fails for certificate: %s. Error: %s", ids, e.getMessage());
LOG.warn(msg, e);
throw new XKMSLocateException(msg, e);
}
}
use of org.apache.cxf.xkms.model.xkms.LocateResultType in project cxf by apache.
the class XKMSServiceTest method locateCertificate.
private void locateCertificate(LocateRequestType request, QueryKeyBindingType queryKeyBindingType, UseKeyWithType useKeyWithType) {
queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
request.setQueryKeyBinding(queryKeyBindingType);
LocateResultType result = xkmsService.locate(request);
assertSuccess(result);
List<UnverifiedKeyBindingType> keyBinding = result.getUnverifiedKeyBinding();
Assert.assertEquals(1, keyBinding.size());
KeyInfoType keyInfo = keyBinding.get(0).getKeyInfo();
Assert.assertNotNull(keyInfo);
}
Aggregations