use of won.cryptography.ssl.PredefinedAliasPrivateKeyStrategy in project webofneeds by researchstudio-sat.
the class LinkedDataRestClientHttps method createRestTemplateForReadingLinkedData.
private RestTemplate createRestTemplateForReadingLinkedData(String webID) {
RestTemplate template = null;
try {
template = CryptographyUtils.createSslRestTemplate(this.keyStoreService.getUnderlyingKeyStore(), this.keyStoreService.getPassword(), new PredefinedAliasPrivateKeyStrategy(keyPairAliasDerivationStrategy.getAliasForNeedUri(webID)), this.trustStoreService.getUnderlyingKeyStore(), this.trustStrategy, readTimeout, connectionTimeout, true);
} catch (Exception e) {
throw new RuntimeException("Failed to create rest template for webID '" + webID + "'", e);
}
template.getMessageConverters().add(datasetConverter);
return template;
}
use of won.cryptography.ssl.PredefinedAliasPrivateKeyStrategy in project webofneeds by researchstudio-sat.
the class LinkedDataRestBridge method createRestTemplateForReadingLinkedData.
private RestTemplate createRestTemplateForReadingLinkedData(String webID) throws Exception {
RestTemplate template = CryptographyUtils.createSslRestTemplate(this.keyStoreService.getUnderlyingKeyStore(), this.keyStoreService.getPassword(), new PredefinedAliasPrivateKeyStrategy(keyPairAliasDerivationStrategy.getAliasForNeedUri(webID)), this.trustStoreService.getUnderlyingKeyStore(), this.trustStrategy, readTimeout, connectionTimeout, true);
// prevent the RestTemplate from throwing an exception when the server responds with 4xx or 5xx status
// because we want to hand the orginal response back to the original caller in BridgeForLinkedDataController
template.setErrorHandler(new DefaultResponseErrorHandler() {
@Override
protected boolean hasError(final HttpStatus statusCode) {
return false;
}
});
return template;
}
Aggregations