tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1645955 - in /tomcat/trunk: java/org/apache/catalina/ha/authenticator/ java/org/apache/catalina/ha/session/ test/org/apache/catalina/ha/
Date Tue, 16 Dec 2014 14:08:48 GMT
Author: markt
Date: Tue Dec 16 14:08:48 2014
New Revision: 1645955

URL: http://svn.apache.org/r1645955
Log:
No longer need SerializablePrincipal in Cluster code since GenericPrincipal now implements
Serializable.

Removed:
    tomcat/trunk/java/org/apache/catalina/ha/session/SerializablePrincipal.java
    tomcat/trunk/test/org/apache/catalina/ha/
Modified:
    tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
    tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
    tomcat/trunk/java/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java

Modified: tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java?rev=1645955&r1=1645954&r2=1645955&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java Tue Dec
16 14:08:48 2014
@@ -30,7 +30,6 @@ import org.apache.catalina.authenticator
 import org.apache.catalina.ha.CatalinaCluster;
 import org.apache.catalina.ha.ClusterManager;
 import org.apache.catalina.ha.ClusterValve;
-import org.apache.catalina.ha.session.SerializablePrincipal;
 import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.tomcat.util.ExceptionUtils;
 
@@ -281,10 +280,8 @@ public class ClusterSingleSignOn extends
             msg.setUsername(username);
             msg.setPassword(password);
 
-            SerializablePrincipal sp = null;
             if (principal instanceof GenericPrincipal) {
-                sp = SerializablePrincipal.createPrincipal((GenericPrincipal) principal);
-                msg.setPrincipal(sp);
+                msg.setPrincipal((GenericPrincipal) principal);
             }
 
             cluster.send(msg);
@@ -346,10 +343,8 @@ public class ClusterSingleSignOn extends
             msg.setUsername(username);
             msg.setPassword(password);
 
-            SerializablePrincipal sp = null;
             if (principal instanceof GenericPrincipal) {
-                sp = SerializablePrincipal.createPrincipal((GenericPrincipal) principal);
-                msg.setPrincipal(sp);
+                msg.setPrincipal((GenericPrincipal) principal);
             }
 
             cluster.send(msg);

Modified: tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java?rev=1645955&r1=1645954&r2=1645955&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
Tue Dec 16 14:08:48 2014
@@ -86,14 +86,14 @@ public class ClusterSingleSignOnListener
                 break;
             case SingleSignOnMessage.REGISTER_SESSION:
                 if (msg.getPrincipal() != null) {
-                    principal = msg.getPrincipal().getPrincipal();
+                    principal = msg.getPrincipal();
                 }
                 clusterSSO.registerLocal(msg.getSsoId(), principal, msg.getAuthType(),
                                          msg.getUsername(), msg.getPassword());
                 break;
             case SingleSignOnMessage.UPDATE_SESSION:
                 if (msg.getPrincipal() != null) {
-                    principal = msg.getPrincipal().getPrincipal();
+                    principal = msg.getPrincipal();
                 }
                 clusterSSO.updateLocal(msg.getSsoId(), principal, msg.getAuthType(),
                                        msg.getUsername(), msg.getPassword());

Modified: tomcat/trunk/java/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java?rev=1645955&r1=1645954&r2=1645955&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java Tue Dec
16 14:08:48 2014
@@ -18,7 +18,7 @@
 package org.apache.catalina.ha.authenticator;
 
 import org.apache.catalina.ha.ClusterMessage;
-import org.apache.catalina.ha.session.SerializablePrincipal;
+import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.catalina.tribes.Member;
 
 /**
@@ -45,7 +45,7 @@ public class SingleSignOnMessage impleme
     private String authType = null;
     private String password = null;
     private String username = null;
-    private SerializablePrincipal principal = null;
+    private GenericPrincipal principal = null;
 
     private Member address = null;
     private long timestamp = 0;
@@ -165,11 +165,11 @@ public class SingleSignOnMessage impleme
         this.username = username;
     }
 
-    public SerializablePrincipal getPrincipal() {
+    public GenericPrincipal getPrincipal() {
         return principal;
     }
 
-    public void setPrincipal(SerializablePrincipal principal) {
+    public void setPrincipal(GenericPrincipal principal) {
         this.principal = principal;
     }
 

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java?rev=1645955&r1=1645954&r2=1645955&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java Tue Dec 16 14:08:48
2014
@@ -100,16 +100,16 @@ public class DeltaRequest implements Ext
      */
     public void setPrincipal(Principal p) {
         int action = (p==null)?ACTION_REMOVE:ACTION_SET;
-        SerializablePrincipal sp = null;
-        if ( p != null ) {
-            if(p instanceof GenericPrincipal) {
-                sp = SerializablePrincipal.createPrincipal((GenericPrincipal)p);
+        GenericPrincipal gp = null;
+        if (p != null) {
+            if (p instanceof GenericPrincipal) {
+                gp = (GenericPrincipal) p;
                 if(log.isDebugEnabled())
                     log.debug(sm.getString("deltaRequest.showPrincipal", p.getName() , getSessionId()));
             } else
                 log.error(sm.getString("deltaRequest.wrongPrincipalClass",p.getClass().getName()));
         }
-        addAction(TYPE_PRINCIPAL,action,NAME_PRINCIPAL,sp);
+        addAction(TYPE_PRINCIPAL, action, NAME_PRINCIPAL, gp);
     }
 
     public void setNew(boolean n) {
@@ -178,9 +178,8 @@ public class DeltaRequest implements Ext
                     break;
                 case TYPE_PRINCIPAL:
                     Principal p = null;
-                    if ( info.getAction() == ACTION_SET ) {
-                        SerializablePrincipal sp = (SerializablePrincipal)info.getValue();
-                        p = sp.getPrincipal();
+                    if (info.getAction() == ACTION_SET) {
+                        p = (Principal) info.getValue();
                     }
                     session.setPrincipal(p,false);
                     break;

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1645955&r1=1645954&r2=1645955&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Tue Dec 16 14:08:48
2014
@@ -38,7 +38,6 @@ import org.apache.catalina.ha.CatalinaCl
 import org.apache.catalina.ha.ClusterManager;
 import org.apache.catalina.ha.ClusterMessage;
 import org.apache.catalina.ha.ClusterSession;
-import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.catalina.session.ManagerBase;
 import org.apache.catalina.session.StandardSession;
 import org.apache.catalina.tribes.io.ReplicationStream;
@@ -721,7 +720,7 @@ public class DeltaSession extends Standa
         boolean hasPrincipal = stream.readBoolean();
         principal = null;
         if (hasPrincipal) {
-            principal = SerializablePrincipal.readPrincipal(stream);
+            principal = (Principal) stream.readObject();
         }
 
         //        setId((String) stream.readObject());
@@ -799,9 +798,9 @@ public class DeltaSession extends Standa
         stream.writeObject(Boolean.valueOf(isValid));
         stream.writeObject(Long.valueOf(thisAccessedTime));
         stream.writeObject(Long.valueOf(version));
-        stream.writeBoolean(getPrincipal() != null);
-        if (getPrincipal() != null) {
-            SerializablePrincipal.writePrincipal((GenericPrincipal) principal,stream);
+        stream.writeBoolean(getPrincipal() instanceof Serializable);
+        if (getPrincipal() instanceof Serializable) {
+            stream.writeObject(getPrincipal());
         }
 
         stream.writeObject(id);



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


Mime
View raw message