Jelajahi Sumber

Rolled back changes for SEC-441.

Luke Taylor 18 tahun lalu
induk
melakukan
976fdb0371

+ 3 - 10
adapters/jboss/src/main/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModule.java

@@ -15,11 +15,6 @@
 
 package org.acegisecurity.adapters.jboss;
 
-import org.apache.commons.lang.ArrayUtils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.acegisecurity.AccountExpiredException;
 import org.acegisecurity.Authentication;
 import org.acegisecurity.AuthenticationException;
@@ -80,8 +75,8 @@ public class JbossAcegiLoginModule extends AbstractServerLoginModule {
     }
 
     protected Group[] getRoleSets() throws LoginException {
-        Group roles = new SimpleGroup("Roles");
-        Group callerPrincipalGroup = new SimpleGroup("CallerPrincipal");
+        SimpleGroup roles = new SimpleGroup("Roles");
+        Group[] roleSets = {roles};
 
         if (this.identity instanceof Authentication) {
             Authentication user = (Authentication) this.identity;
@@ -91,9 +86,7 @@ public class JbossAcegiLoginModule extends AbstractServerLoginModule {
             }
         }
 
-        callerPrincipalGroup.addMember(getIdentity());
-
-        return new Group[] {roles, callerPrincipalGroup};
+        return roleSets;
     }
 
     protected String[] getUsernameAndPassword() throws LoginException {

+ 2 - 16
adapters/jboss/src/test/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModuleTests.java

@@ -320,23 +320,12 @@ public class JbossAcegiLoginModuleTests extends TestCase {
         assertTrue(adapter.login());
 
         Group[] result = adapter.getRoleSets();
-        // Expect Roles and CallerPrincipal groups.
-        assertEquals(2, result.length);
+        // Expect Roles group.
+        assertEquals(1, result.length);
 
         Group roles = result[0];
         assertTrue(roles.isMember(new SimplePrincipal("ROLE_TELLER")));
         assertTrue(roles.isMember(new SimplePrincipal("ROLE_SUPERVISOR")));
-
-        Group callerPrincipalGroup = result[1];
-        // check the name
-        assertTrue(callerPrincipalGroup.equals(new SimpleGroup("CallerPrincipal")));
-        Enumeration members = callerPrincipalGroup.members();
-        assertTrue("CallerPrincipal group must have exactly one member", members.hasMoreElements());
-        Principal principal = (Principal) members.nextElement();
-        if (!(principal instanceof PrincipalAcegiUserToken)) {
-            fail("Should have returned PrincipalAcegiUserToken");
-        }
-        assertTrue("CallerPrincipal group must have exactly one member", !members.hasMoreElements());
     }
 
     //~ Inner Classes ==================================================================================================
@@ -350,9 +339,6 @@ public class JbossAcegiLoginModuleTests extends TestCase {
             this.password = password;
         }
 
-        private MockCallbackHandler() {
-        }
-
         public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
             for (int i = 0; i < callbacks.length; i++) {
                 if (callbacks[i] instanceof NameCallback) {