summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-04 15:59:16 +0200
committerSimon Rettberg2015-09-04 15:59:16 +0200
commitb3a9b0dab081892ba980ae52913e6d103e9ef805 (patch)
tree4457e69c3e572f58110ad52432b73e506ed3122e
parentCheck StatusCode returned by IdP; set proper content type in requests to IdP;... (diff)
downloadecp-client-lean-b3a9b0dab081892ba980ae52913e6d103e9ef805.tar.gz
ecp-client-lean-b3a9b0dab081892ba980ae52913e6d103e9ef805.tar.xz
ecp-client-lean-b3a9b0dab081892ba980ae52913e6d103e9ef805.zip
Apply short timeouts to http requests
-rw-r--r--src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java
index 4dfdb39..3d9d801 100644
--- a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java
+++ b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java
@@ -14,6 +14,7 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -32,6 +33,11 @@ public class ECPAuthenticator extends ECPAuthenticatorBase {
public ECPAuthenticator(String username, String password,
URI idpEcpEndpoint, URI spUrl) {
this(new DefaultHttpClient(), username, password, idpEcpEndpoint, spUrl);
+ HttpParams params = client.getParams();
+ params.setParameter("http.socket.timeout", 6000);
+ params.setParameter("http.connection.timeout", 3000);
+ params.setParameter("http.connection-manager.timeout", new Long(3000));
+ params.setParameter("http.protocol.head-body-timeout", 5000);
}
public void authenticate() throws ECPAuthenticationException {