summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-10-03 11:05:14 +0000
committerStef Walter <stef@memberwebs.com>2006-10-03 11:05:14 +0000
commit8135e62aa423f7ae08b2cbfcccf4a634ae0cb122 (patch)
tree9fde18450eaf1ceee466c30a5d55ab412f0fc708 /java/src
parentadac001d2fb062e51da00d79cead28bfcaf99bce (diff)
- In the Jetty authenticator generate a unique authentication identifier
which facilitates NTLM authentication
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/memberwebs/httpauth/jetty/JettyHttpAuthenticator.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/java/src/com/memberwebs/httpauth/jetty/JettyHttpAuthenticator.java b/java/src/com/memberwebs/httpauth/jetty/JettyHttpAuthenticator.java
index 1b89436..0bf826d 100644
--- a/java/src/com/memberwebs/httpauth/jetty/JettyHttpAuthenticator.java
+++ b/java/src/com/memberwebs/httpauth/jetty/JettyHttpAuthenticator.java
@@ -100,11 +100,25 @@ public class JettyHttpAuthenticator
String user = null;
+ // Build a unique and consistent Connection ID so that NTLM works
+ Object obj = request.getHttpConnection().getObject();
+ if(obj == null)
+ {
+ obj = "" + Math.random();
+ request.getHttpConnection().setObject(obj);
+ }
+
+ StringBuffer connid = new StringBuffer(32);
+ connid.append(obj.toString());
+ connid.append(":");
+ connid.append(obj.hashCode());
+ connid.append(":");
+ connid.append(request.getHttpConnection().hashCode());
+
try
{
- // Connection ID is random. This prevents NTLM from working :(
- String connid = "" + Math.random();
- user = authenticateRequest(request, response, connid, request.getMethod(),
+ // Send off to httpauth for authentication
+ user = authenticateRequest(request, response, connid.toString(), request.getMethod(),
request.getURI().toString(), authtypes);
}
catch(HttpAuthException e)