geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r123519 - /geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
Date Tue, 28 Dec 2004 16:01:30 GMT
Author: djencks
Date: Tue Dec 28 08:01:28 2004
New Revision: 123519

URL: http://svn.apache.org/viewcvs?view=rev&rev=123519
Log:
The use of loginDomainName is still broken
Modified:
   geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java?view=diff&rev=123519&p1=geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java&r1=123518&p2=geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java&r2=123519
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
Tue Dec 28 08:01:28 2004
@@ -39,13 +39,16 @@
     public void testMultipleLoginDomains() throws Exception {
         JaasLoginModuleConfiguration m1 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D1");
         JaasLoginModuleConfiguration m2 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D2");
+        JaasLoginModuleConfiguration m3 = new JaasLoginModuleConfiguration(MockLoginModule2.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D3");
         JaasSecurityContext c = new JaasSecurityContext("realm", new JaasLoginModuleConfiguration[]
{m1, m2});
         ClassLoader cl = this.getClass().getClassLoader();
         Subject s = c.getSubject();
         m1.getLoginModule(cl).initialize(s, null, null, null);
         m2.getLoginModule(cl).initialize(s, null, null, null);
+        m3.getLoginModule(cl).initialize(s, null, null, null);
         m1.getLoginModule(cl).login();
         m2.getLoginModule(cl).login();
+        m3.getLoginModule(cl).login();
         m1.getLoginModule(cl).commit();
         c.processPrincipals("D1");
         assertEquals(2, s.getPrincipals().size());
@@ -54,6 +57,9 @@
         //Uncomment the following line to verify that the subject will have only 2 principals
rather than the desired 3 after both
         //login modules have tried to add the same principal to the subject.
         assertEquals(3, s.getPrincipals().size());
+        c.processPrincipals("D3");
+        //algorithmm is still broken, as can be seen by uncommenting the next line
+//        assertEquals(3, s.getPrincipals().size());
     }
 
     public static class MockLoginModule implements LoginModule {
@@ -70,6 +76,31 @@
 
         public boolean commit() throws LoginException {
             subject.getPrincipals().add(new GeronimoGroupPrincipal("Foo"));
+            return true;
+        }
+
+        public boolean abort() throws LoginException {
+            return false;
+        }
+
+        public boolean logout() throws LoginException {
+            return false;
+        }
+    }
+
+    public static class MockLoginModule2 implements LoginModule {
+
+        Subject subject;
+
+        public void initialize(Subject subject, CallbackHandler callbackHandler, Map map,
Map map1) {
+            this.subject = subject;
+        }
+
+        public boolean login() throws LoginException {
+            return true;
+        }
+
+        public boolean commit() throws LoginException {
             return true;
         }
 

Mime
View raw message