Author: rjung Date: Wed Nov 26 17:29:24 2014 New Revision: 1641865 URL: http://svn.apache.org/r1641865 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.
Backport of r1153318 from TC6. Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaRequest.java tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml?rev=1641865&r1=1641864&r2=1641865&view=diff ============================================================================== --- tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml (original) +++ tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml Wed Nov 26 17:29:24 2014 @@ -32,6 +32,11 @@ <section name="Tomcat OACC 0.1 (rjung)"> <subsection name="Cluster"> <fix> + <bug>50771</bug>: Ensure HttpServletRequest#getAuthType() returns the + name of the authentication scheme if request has already been + authenticated. (kfujino) + </fix> + <fix> The change in session ID is notified to the container event listener on the backup node in cluster. This notification is controlled by notifyContainerListenersOnReplication. (kfujino) Modified: tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaRequest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaRequest.java?rev=1641865&r1=1641864&r2=1641865&view=diff ============================================================================== --- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaRequest.java (original) +++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaRequest.java Wed Nov 26 17:29:24 2014 @@ -51,6 +51,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; @@ -58,6 +59,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(); @@ -116,6 +118,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, @@ -180,6 +187,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/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java?rev=1641865&r1=1641864&r2=1641865&view=diff ============================================================================== --- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java (original) +++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java Wed Nov 26 17:29:24 2014 @@ -261,6 +261,28 @@ public class DeltaSession extends Standa } /** + * Set the authentication type used to authenticate our cached + * Principal, if any. + * + * @param authType The new cached authentication type + */ + @Override + 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() { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org