abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r556731 - /incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java
Date Mon, 16 Jul 2007 20:44:31 GMT
Author: jmsnell
Date: Mon Jul 16 13:44:30 2007
New Revision: 556731

URL: http://svn.apache.org/viewvc?view=rev&rev=556731
Log:
DHContext needs to be unique to each session

Modified:
    incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java?view=diff&rev=556731&r1=556730&r2=556731
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java
(original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedRequestFilter.java
Mon Jul 16 13:44:30 2007
@@ -38,13 +38,10 @@
  */
 public class DHEncryptedRequestFilter 
   extends BCEncryptedRequestFilter {
-
-  private DHContext context;
   
   @Override
   public void init(FilterConfig config) throws ServletException {
     super.init(config);
-    context = new DHContext();
   }
   
   @Override
@@ -58,19 +55,23 @@
     if ("GET".equalsIgnoreCase(method) || 
         "HEAD".equalsIgnoreCase(method) || 
         "OPTIONS".equalsIgnoreCase(method)) {
+      DHContext context = new DHContext();
       ((HttpServletResponse)response).setHeader(
         DHEncryptedResponseFilter.DH, 
-        this.context.getRequestString());
+        context.getRequestString());
+      ((HttpServletRequest) request).getSession(true).setAttribute(
+        "dhcontext", context);
     } 
   }
 
   @Override
   protected Object initArg(ServletRequest request) {
-    DHContext context = null;
+    DHContext context = 
+      (DHContext) ((HttpServletRequest)request).
+        getSession(true).getAttribute("dhcontext");
     String dh = ((HttpServletRequest)request).getHeader(DHEncryptedResponseFilter.DH);
-    if (dh != null && dh.length() > 0) {
+    if (context != null && dh != null && dh.length() > 0) {
       try {
-        context = (DHContext) this.context.clone();
         context.setPublicKey(dh);
       } catch (Exception e) {
         e.printStackTrace();



Mime
View raw message