geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r279866 - in /geronimo/trunk/modules/security/src: java/org/apache/geronimo/security/ java/org/apache/geronimo/security/jaas/ test/org/apache/geronimo/security/jaas/
Date Fri, 09 Sep 2005 20:22:55 GMT
Author: adc
Date: Fri Sep  9 13:22:52 2005
New Revision: 279866

URL: http://svn.apache.org/viewcvs?rev=279866&view=rev
Log:
ContextManager.registerPrincipal() should be removed
GERONIMO-986

Modified:
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/ContextManager.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/RealmPrincipal.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasSecurityContext.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/ContextManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/ContextManager.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/ContextManager.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/ContextManager.java
Fri Sep  9 13:22:52 2005
@@ -48,7 +48,6 @@
     private static Map subjectContexts = new IdentityHashMap();
     private static Map subjectIds = new Hashtable();
     private static long nextSubjectId = System.currentTimeMillis();
-    private static Map principals = new Hashtable();
 
     private static long nextPrincipalId = System.currentTimeMillis();
 
@@ -240,29 +239,6 @@
 
         subjectIds.remove(context.id);
         subjectContexts.remove(subject);
-    }
-
-    public static RealmPrincipal registerPrincipal(RealmPrincipal principal) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) sm.checkPermission(SET_CONTEXT);
-
-
-        if (principal == null) throw new IllegalArgumentException("Principal must not be
null");
-
-        RealmPrincipal result = (RealmPrincipal) principals.get(principal);
-
-        if (result == null) {
-            synchronized (principals) {
-                result = (RealmPrincipal) principals.get(principal);
-                if (result == null) {
-                    principal.setId(nextPrincipalId++);
-                    principals.put(principal, principal);
-                    result = principal;
-                }
-            }
-        }
-
-        return result;
     }
 
     /**

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/RealmPrincipal.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/RealmPrincipal.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/RealmPrincipal.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/RealmPrincipal.java
Fri Sep  9 13:22:52 2005
@@ -29,7 +29,6 @@
     private final String loginDomain;
     private final Principal principal;
     private transient String name = null;
-    private transient long id;
 
     public RealmPrincipal(String loginDomain, Principal principal) {
         if (loginDomain == null) throw new IllegalArgumentException("loginDomain is null");
@@ -37,14 +36,6 @@
 
         this.loginDomain = loginDomain;
         this.principal = principal;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    void setId(long id) {
-        this.id = id;
     }
 
     /**

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasSecurityContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasSecurityContext.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasSecurityContext.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasSecurityContext.java
Fri Sep  9 13:22:52 2005
@@ -115,7 +115,7 @@
         for (Iterator it = subject.getPrincipals().iterator(); it.hasNext();) {
             Principal p = (Principal) it.next();
             if(!(p instanceof RealmPrincipal) && !processedPrincipals.contains(p))
{
-                list.add(ContextManager.registerPrincipal(new RealmPrincipal(loginDomainName,
p)));
+                list.add(new RealmPrincipal(loginDomainName, p));
                 processedPrincipals.add(p);
             }
         }
@@ -127,7 +127,7 @@
         for (int i = 0; i < principals.length; i++) {
             Principal p = principals[i];
             list.add(p);
-            list.add(ContextManager.registerPrincipal(new RealmPrincipal(loginDomainName,
p)));
+            list.add(new RealmPrincipal(loginDomainName, p));
             processedPrincipals.add(p);
         }
         subject.getPrincipals().addAll(list);

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
Fri Sep  9 13:22:52 2005
@@ -90,8 +90,6 @@
         assertTrue("server subject should have two realm principals ("+subject.getPrincipals(RealmPrincipal.class).size()+")",
subject.getPrincipals(RealmPrincipal.class).size() == 2);
         assertTrue("server subject should have five principals ("+subject.getPrincipals().size()+")",
subject.getPrincipals().size() == 5);
         assertTrue("server subject should have one private credential ("+subject.getPrivateCredentials().size()+")",
subject.getPrivateCredentials().size() == 1);
-        RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
-        assertTrue("id of principal should be non-zero", principal.getId() != 0);
 
         context.logout();
 
@@ -120,8 +118,6 @@
         assertTrue("server subject should have two realm principals ("+subject.getPrincipals(RealmPrincipal.class).size()+")",
subject.getPrincipals(RealmPrincipal.class).size() == 2);
         assertTrue("server subject should have five principals ("+subject.getPrincipals().size()+")",
subject.getPrincipals().size() == 5);
         assertTrue("server subject should have one private credential ("+subject.getPrivateCredentials().size()+")",
subject.getPrivateCredentials().size() == 1);
-        principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
-        assertTrue("id of principal should be non-zero", principal.getId() != 0);
 
         context.logout();
 

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
Fri Sep  9 13:22:52 2005
@@ -160,8 +160,6 @@
         assertTrue("subject should be associated with remote id", ContextManager.getRegisteredSubject(remote.getId())
!= null);
         assertEquals("subject should have five principals (" + subject.getPrincipals().size()
+ ")", 5, subject.getPrincipals().size());
         assertEquals("subject should have two realm principals (" + subject.getPrincipals(RealmPrincipal.class).size()
+ ")", 2, subject.getPrincipals(RealmPrincipal.class).size());
-        RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
-        assertTrue("id of principal should be non-zero", principal.getId() != 0);
 
         context.logout();
 

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java
Fri Sep  9 13:22:52 2005
@@ -18,7 +18,6 @@
 package org.apache.geronimo.security.jaas;
 
 import java.io.File;
-import java.net.URI;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Properties;
@@ -193,8 +192,6 @@
         assertTrue("server subject should be associated with remote id", ContextManager.getRegisteredSubject(remote.getId())
!= null);
         assertTrue("server subject should have five principals", subject.getPrincipals().size()
== 5);
         assertTrue("server subject should have two realm principal", subject.getPrincipals(RealmPrincipal.class).size()
== 2);
-        RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
-        assertTrue("id of principal should be non-zero", principal.getId() != 0);
 
         assertTrue("id of server subject should be non-null", ContextManager.getSubjectId(subject)
!= null);
 



Mime
View raw message