geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1097151 - /geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
Date Wed, 27 Apr 2011 15:35:23 GMT
Author: genspring
Date: Wed Apr 27 15:35:23 2011
New Revision: 1097151

URL: http://svn.apache.org/viewvc?rev=1097151&view=rev
Log:
GERONIMO-5937 Currently, connector will call ContextManager.unresigterSubject in the after
callback method even when the current subject is the default ContextManager.EMPTY subject.

1, don't unregister default EMPTY subject.
2, add a empty non-null principal to the EMPTY subject.

Modified:
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java?rev=1097151&r1=1097150&r2=1097151&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
Wed Apr 27 15:35:23 2011
@@ -75,6 +75,11 @@ public class ContextManager {
     }
     public final static Subject EMPTY = new Subject();
     static {
+        EMPTY.getPrincipals().add(new Principal() {
+            public String getName() {
+                return "";
+            }
+        });
         EMPTY.setReadOnly();
         registerSubject(EMPTY);
     }
@@ -221,11 +226,7 @@ public class ContextManager {
         if (sm != null) sm.checkPermission(GET_CONTEXT);
 
         if (callerSubject == null) {
-            return new Principal() {
-                public String getName() {
-                    return "";
-                }
-            };
+            return EMPTY.getPrincipals().iterator().next();
         }
         Context context = subjectContexts.get(callerSubject);
 
@@ -341,6 +342,11 @@ public class ContextManager {
     }
 
     public static synchronized void unregisterSubject(Subject subject) {
+        
+        if (subject == EMPTY) {
+            return;
+        }
+        
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) sm.checkPermission(SET_CONTEXT);
 



Mime
View raw message