Rolled back changes for SEC-441.

This commit is contained in:
Luke Taylor 2007-08-30 22:28:04 +00:00
parent 0d8be5012d
commit 976fdb0371
2 changed files with 5 additions and 26 deletions

View File

@ -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 {

View File

@ -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) {