Rolled back changes for SEC-441.
This commit is contained in:
parent
0d8be5012d
commit
976fdb0371
|
@ -15,11 +15,6 @@
|
||||||
|
|
||||||
package org.acegisecurity.adapters.jboss;
|
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.AccountExpiredException;
|
||||||
import org.acegisecurity.Authentication;
|
import org.acegisecurity.Authentication;
|
||||||
import org.acegisecurity.AuthenticationException;
|
import org.acegisecurity.AuthenticationException;
|
||||||
|
@ -80,8 +75,8 @@ public class JbossAcegiLoginModule extends AbstractServerLoginModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Group[] getRoleSets() throws LoginException {
|
protected Group[] getRoleSets() throws LoginException {
|
||||||
Group roles = new SimpleGroup("Roles");
|
SimpleGroup roles = new SimpleGroup("Roles");
|
||||||
Group callerPrincipalGroup = new SimpleGroup("CallerPrincipal");
|
Group[] roleSets = {roles};
|
||||||
|
|
||||||
if (this.identity instanceof Authentication) {
|
if (this.identity instanceof Authentication) {
|
||||||
Authentication user = (Authentication) this.identity;
|
Authentication user = (Authentication) this.identity;
|
||||||
|
@ -91,9 +86,7 @@ public class JbossAcegiLoginModule extends AbstractServerLoginModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callerPrincipalGroup.addMember(getIdentity());
|
return roleSets;
|
||||||
|
|
||||||
return new Group[] {roles, callerPrincipalGroup};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getUsernameAndPassword() throws LoginException {
|
protected String[] getUsernameAndPassword() throws LoginException {
|
||||||
|
|
|
@ -320,23 +320,12 @@ public class JbossAcegiLoginModuleTests extends TestCase {
|
||||||
assertTrue(adapter.login());
|
assertTrue(adapter.login());
|
||||||
|
|
||||||
Group[] result = adapter.getRoleSets();
|
Group[] result = adapter.getRoleSets();
|
||||||
// Expect Roles and CallerPrincipal groups.
|
// Expect Roles group.
|
||||||
assertEquals(2, result.length);
|
assertEquals(1, result.length);
|
||||||
|
|
||||||
Group roles = result[0];
|
Group roles = result[0];
|
||||||
assertTrue(roles.isMember(new SimplePrincipal("ROLE_TELLER")));
|
assertTrue(roles.isMember(new SimplePrincipal("ROLE_TELLER")));
|
||||||
assertTrue(roles.isMember(new SimplePrincipal("ROLE_SUPERVISOR")));
|
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 ==================================================================================================
|
//~ Inner Classes ==================================================================================================
|
||||||
|
@ -350,9 +339,6 @@ public class JbossAcegiLoginModuleTests extends TestCase {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MockCallbackHandler() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
||||||
for (int i = 0; i < callbacks.length; i++) {
|
for (int i = 0; i < callbacks.length; i++) {
|
||||||
if (callbacks[i] instanceof NameCallback) {
|
if (callbacks[i] instanceof NameCallback) {
|
||||||
|
|
Loading…
Reference in New Issue