aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main/java')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java6
-rw-r--r--id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java52
2 files changed, 49 insertions, 9 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
index 6ef7a00cd..0e729ca5b 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -60,7 +60,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
List<AbstractConfigProperty> configResult = configQuery.getResultList();
if (configResult == null || configResult.isEmpty()) {
- Logger.warn("Found no configuration keys with prefix: " + preFix + ".%");
+ Logger.debug("Found no configuration keys with prefix: " + preFix + ".%");
return null;
}
@@ -98,7 +98,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
List<AbstractConfigProperty> configResult = configQuery.getResultList();
if (configResult == null || configResult.isEmpty()) {
- Logger.warn("Found no configuration keys with searchKey: " + searchKey);
+ Logger.debug("Found no configuration keys with searchKey: " + searchKey);
return null;
}
@@ -228,7 +228,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
List<AbstractConfigProperty> oaConfigResult = oaConfigQuery.getResultList();
if (oaConfigResult == null) {
- Logger.warn("Found no configuration keys with prefix: " + oaKey + ".%");
+ Logger.info("Found no configuration keys with prefix: " + oaKey + ".%");
return null;
}
Logger.trace("Find " + oaConfigResult.size() + " key/value pairs with prefix: " + oaKey + ".%");
diff --git a/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java b/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
index edf7ce268..4d4c7fa88 100644
--- a/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
+++ b/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
@@ -26,10 +26,12 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
-import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException;
+import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.MiscUtil;
/**
* @author tlenz
@@ -39,10 +41,48 @@ import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException
*/
public class MOAHttpClient extends HttpClient {
-
- public void setCustomSSLTrustStore(String metadataURL, ProtocolSocketFactory protoSocketFactory) throws MOAHttpProtocolSocketFactoryException, MalformedURLException {
- ;
-
+ public MOAHttpClient() {
+ super();
+ injectProxyCredentials();
+
+ }
+
+ public void injectProxyCredentials() {
+ //set proxy functionality
+ String host = System.getProperty("http.proxyHost"); //$NON-NLS-1$
+ String port = System.getProperty("http.proxyPort"); //$NON-NLS-1$
+ String user = System.getProperty("http.proxyUser"); //$NON-NLS-1$
+ String pass = System.getProperty("http.proxyPassword"); //$NON-NLS-1$
+
+ if (MiscUtil.isNotEmpty(host)) {
+ int p = -1;
+ if (MiscUtil.isNotEmpty(port)) {
+ try {
+ p = Integer.parseInt(port);
+
+ } catch (Exception e) {
+ Logger.error("'http.proxyPort' not valid!", e);
+
+ }
+ }
+ Logger.info("Set HTTP-Proxy to Host: " + host + " and port: " + p);
+ getHostConfiguration().setProxy(host, p);
+ if (MiscUtil.isNotEmpty(user) && pass != null) {
+ //set proxy credentials
+ AuthScope authscope = new AuthScope(host, p);
+ Credentials credentials = new UsernamePasswordCredentials(user, pass);
+ getState().setProxyCredentials(authscope, credentials);
+ Logger.info(" Use Proxy with Username: " + user + " and password: "
+ + (Logger.isTraceEnabled() ? pass : "*******"));
+
+ }
+
+ }
+ }
+
+ public void setCustomSSLTrustStore(String metadataURL, ProtocolSocketFactory protoSocketFactory)
+ throws MalformedURLException {
+
URL url = new URL(metadataURL);
int port = -1;
if (url.getPort() < 0)
@@ -52,7 +92,7 @@ public class MOAHttpClient extends HttpClient {
Protocol authhttps = new Protocol("https", protoSocketFactory, 443);
getHostConfiguration().setHost(url.getHost(), port, authhttps);
-
+
}
public int executeMethod(HostConfiguration hostconfig,