Author: markt
Date: Tue Aug 16 12:37:25 2011
New Revision: 1158238

URL: http://svn.apache.org/viewvc?rev=1158238&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50771
Ensure HttpServletRequest#getAuthType() returns the name of the authentication 
scheme 
if request has already been authenticated. (kfujino)

Modified:
    tomcat/tc5.5.x/trunk/STATUS.txt
    
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
    
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
    
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaRequest.java
    
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
    tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml

Modified: tomcat/tc5.5.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Aug 16 12:37:25 2011
@@ -25,14 +25,6 @@ $Id$
 PATCHES PROPOSED TO BACKPORT:
   [ New proposals should be added at the end of the list ]
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50771
-  Ensure HttpServletRequest#getAuthType() returns the name of the 
authentication scheme 
-  if request has already been authenticated.
-  http://svn.apache.org/viewvc?view=revision&revision=1070409
-  https://issues.apache.org/bugzilla/attachment.cgi?id=26650 (patch against 
tc5.5)
-  +1: kfujino, markt, kkolinko
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50744
   Skip SSL configuration check if we cannot create an unbound socket
   https://issues.apache.org/bugzilla/attachment.cgi?id=26651

Modified: 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaRequest.java
 Tue Aug 16 12:37:25 2011
@@ -50,6 +50,7 @@ public class DeltaRequest implements Ext
     public static final int TYPE_PRINCIPAL = 1;
     public static final int TYPE_ISNEW = 2;
     public static final int TYPE_MAXINTERVAL = 3;
+    public static final int TYPE_AUTHTYPE = 4;
 
     public static final int ACTION_SET = 0;
     public static final int ACTION_REMOVE = 1;
@@ -57,6 +58,7 @@ public class DeltaRequest implements Ext
     public static final String NAME_PRINCIPAL = "__SET__PRINCIPAL__";
     public static final String NAME_MAXINTERVAL = "__SET__MAXINTERVAL__";
     public static final String NAME_ISNEW = "__SET__ISNEW__";
+    public static final String NAME_AUTHTYPE = "__SET__AUTHTYPE__";
 
     private String sessionId;
     private LinkedList actions = new LinkedList();
@@ -115,6 +117,11 @@ public class DeltaRequest implements Ext
         addAction(TYPE_ISNEW,action,NAME_ISNEW,new Boolean(n));
     }
 
+    public void setAuthType(String authType) {
+        int action = (authType==null)?ACTION_REMOVE:ACTION_SET;
+        addAction(TYPE_AUTHTYPE,action,NAME_AUTHTYPE, authType);
+    }
+
     protected synchronized void addAction(int type,
                              int action,
                              String name,
@@ -179,6 +186,14 @@ public class DeltaRequest implements Ext
                     session.setPrincipal(p,false);
                     break;
                 }//case
+                case TYPE_AUTHTYPE: {
+                    String authType = null;
+                    if ( info.getAction() == ACTION_SET ) {
+                        authType = (String)info.getValue();
+                    }
+                    session.setAuthType(authType,false);
+                    break;
+                }//case
                 default : throw new 
java.lang.IllegalArgumentException("Invalid attribute info type="+info);
             }//switch
         }//for

Modified: 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
 Tue Aug 16 12:37:25 2011
@@ -317,11 +317,15 @@ public class DeltaSession implements Htt
      *            The new cached authentication type
      */
     public void setAuthType(String authType) {
+        setAuthType(authType, true);
+    }
 
+    public void setAuthType(String authType, boolean addDeltaRequest) {
         String oldAuthType = this.authType;
         this.authType = authType;
         support.firePropertyChange("authType", oldAuthType, this.authType);
-
+        if (addDeltaRequest && (deltaRequest != null))
+            deltaRequest.setAuthType(authType);
     }
 
     /**

Modified: 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaRequest.java?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaRequest.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaRequest.java
 Tue Aug 16 12:37:25 2011
@@ -53,6 +53,7 @@ public class DeltaRequest implements Ext
     public static final int TYPE_PRINCIPAL = 1;
     public static final int TYPE_ISNEW = 2;
     public static final int TYPE_MAXINTERVAL = 3;
+    public static final int TYPE_AUTHTYPE = 4;
 
     public static final int ACTION_SET = 0;
     public static final int ACTION_REMOVE = 1;
@@ -60,6 +61,7 @@ public class DeltaRequest implements Ext
     public static final String NAME_PRINCIPAL = "__SET__PRINCIPAL__";
     public static final String NAME_MAXINTERVAL = "__SET__MAXINTERVAL__";
     public static final String NAME_ISNEW = "__SET__ISNEW__";
+    public static final String NAME_AUTHTYPE = "__SET__AUTHTYPE__";
 
     private String sessionId;
     private LinkedList actions = new LinkedList();
@@ -118,6 +120,11 @@ public class DeltaRequest implements Ext
         addAction(TYPE_ISNEW,action,NAME_ISNEW,new Boolean(n));
     }
 
+    public void setAuthType(String authType) {
+        int action = (authType==null)?ACTION_REMOVE:ACTION_SET;
+        addAction(TYPE_AUTHTYPE,action,NAME_AUTHTYPE, authType);
+    }
+
     protected synchronized void addAction(int type,
                              int action,
                              String name,
@@ -188,6 +195,14 @@ public class DeltaRequest implements Ext
                     session.setPrincipal(p,false);
                     break;
                 }//case
+                case TYPE_AUTHTYPE: {
+                    String authType = null;
+                    if ( info.getAction() == ACTION_SET ) {
+                        authType = (String)info.getValue();
+                    }
+                    session.setAuthType(authType,false);
+                    break;
+                }//case
                 default : throw new 
java.lang.IllegalArgumentException("Invalid attribute info type="+info);
             }//switch
         }//for

Modified: 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
 Tue Aug 16 12:37:25 2011
@@ -305,6 +305,27 @@ public class DeltaSession extends Standa
     }
 
     /**
+     * Set the authentication type used to authenticate our cached
+     * Principal, if any.
+     *
+     * @param authType The new cached authentication type
+     */
+    public void setAuthType(String authType) {
+        setAuthType(authType, true);
+    }
+
+    public void setAuthType(String authType, boolean addDeltaRequest) {
+        try { 
+            lock();
+            super.setAuthType(authType);
+            if (addDeltaRequest && (deltaRequest != null))
+                deltaRequest.setAuthType(authType);
+        } finally {
+            unlock();
+        }
+    }
+
+    /**
      * Return the <code>isValid</code> flag for this session.
      */
     public boolean isValid() {

Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=1158238&r1=1158237&r2=1158238&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original)
+++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Tue Aug 16 
12:37:25 2011
@@ -85,6 +85,15 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Cluster">
+    <changelog>
+      <fix>
+        <bug>50771</bug>: Ensure HttpServletRequest#getAuthType() returns the
+        name of the authentication scheme if request has already been
+        authenticated. (kfujino)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Webapps">
     <changelog>
       <fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to