Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a6b3f9ca authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

remove empty lines

parent ad211a16
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,6 @@ public class UIKeystoreService {
@Autowired
private ConversionService conversionService;
@Value("${smp.keystore.password}")
private String smpKeyStorePasswordEncrypted;
......@@ -108,7 +107,6 @@ public class UIKeystoreService {
}
// decrypt password
smpKeyStorePasswordDecrypted = securityUtilsServices.decrypt(file, smpKeyStorePasswordEncrypted);
}
/**
......@@ -145,20 +143,15 @@ public class UIKeystoreService {
Map<String, Key> hmKeys = new HashMap<>();
Map<String, X509Certificate> hmCertificates = new HashMap<>();
try {
List<String> aliases = list(keyStore.aliases());
for (String alias : aliases) {
loadKeyAndCert(keyStore, alias, hmKeys, hmCertificates);
}
} catch (Exception exception) {
LOG.error("Could not load signing certificate amd private keys Error: " + ExceptionUtils.getRootCauseMessage(exception), exception);
return;
}
// if got all data from keystore - update data
keyManagers = keyManagersTemp;
......@@ -172,16 +165,13 @@ public class UIKeystoreService {
lastUpdateKeystoreFile = keystoreFile;
// clear list to reload RO when required
certificateROList.clear();
}
boolean isKeyStoreChanged() {
File file = getKeyStoreFile();
return !Objects.equals(lastUpdateKeystoreFile, file) || file.lastModified() != lastUpdateKeystoreFileTime;
}
public File getKeyStoreFile() {
return new File(configurationDir + File.separator + smpKeyStoreFilename);
}
......@@ -194,7 +184,6 @@ public class UIKeystoreService {
return keyManagers;
}
private KeyStore loadKeystore(File keyStoreFile) {
// Load the KeyStore.
if (!keyStoreFile.exists()) {
......@@ -226,7 +215,6 @@ public class UIKeystoreService {
hmCertificates.put(alias, (X509Certificate) certificate);
}
public List<CertificateRO> getKeystoreEntriesList() {
if (isKeyStoreChanged()) {
......@@ -245,7 +233,6 @@ public class UIKeystoreService {
return certificateROList;
}
public CertificateRO convertToRo(X509Certificate d) {
return conversionService.convert(d, CertificateRO.class);
}
......
......@@ -29,29 +29,21 @@ import org.apache.cxf.ext.logging.LoggingFeature;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.ProxyServerType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.MessageContext;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.KeyStore;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
......@@ -59,7 +51,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
/**
* Factory creating CXF client that access BDMSL via SOAP interface.
* Produced client has already configured all transport and authentication parameters like URL, keystore, proxy etc...
*
* <p>
* Created by gutowpa on 14/12/2017.
*/
@Component
......@@ -75,9 +67,6 @@ public class SmlClientFactory {
@Autowired
UIKeystoreService keystoreService;
@Value("${bdmsl.integration.proxy.server:}")
private String proxyServer;
......@@ -90,8 +79,6 @@ public class SmlClientFactory {
@Value("${bdmsl.integration.proxy.password:}")
private String proxyPassword;
@Bean
@Scope("prototype")
public IManageParticipantIdentifierWS create(String clientKeyAlias, String clientCertHttpHeader, boolean blueCoatAuthentication) {
......@@ -107,7 +94,6 @@ public class SmlClientFactory {
throw new IllegalStateException("Could not create participant URL: " + smlUrl.toString(), e);
}
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
Map<String, Object> requestContext = ((BindingProvider) smlPort).getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlParticipantIdentifier.toString());
......@@ -116,8 +102,8 @@ public class SmlClientFactory {
configureProxy(httpConduit);
configurePayloadLogging(client);
configureClientAuthentication(httpConduit, requestContext,
blueCoatAuthentication?null:clientKeyAlias,
blueCoatAuthentication?clientCertHttpHeader:null);
blueCoatAuthentication ? null : clientKeyAlias,
blueCoatAuthentication ? clientCertHttpHeader : null);
return smlPort;
}
......@@ -146,8 +132,8 @@ public class SmlClientFactory {
configureProxy(httpConduit);
configurePayloadLogging(client);
configureClientAuthentication(httpConduit, requestContext,
blueCoatAuthentication?null:clientKeyAlias,
blueCoatAuthentication?clientCertHttpHeader:null);
blueCoatAuthentication ? null : clientKeyAlias,
blueCoatAuthentication ? clientCertHttpHeader : null);
return smlPort;
}
......@@ -167,7 +153,7 @@ public class SmlClientFactory {
Map<String, List<String>> customHeaders = new HashMap<>();
customHeaders.put(CLIENT_CERT_HEADER_KEY, asList(smlClientCertHttpHeader));
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, customHeaders);
} else{
} else {
throw new IllegalStateException("SML integration is wrongly configured, at least one authentication option is required: 2-way-SSL or Client-Cert header");
}
}
......@@ -188,7 +174,7 @@ public class SmlClientFactory {
return;
}
LOG.info("Configuring proxy for BDMSL integration client: {}:{}@{}:{}", proxyUser, "########", proxyServer,proxyPort.isPresent()? proxyPort.get():"");
LOG.info("Configuring proxy for BDMSL integration client: {}:{}@{}:{}", proxyUser, "########", proxyServer, proxyPort.isPresent() ? proxyPort.get() : "");
httpConduit.getClient().setProxyServerType(ProxyServerType.HTTP);
httpConduit.getClient().setProxyServer(proxyServer);
if (proxyPort.isPresent()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment