Rexxe, I'm the maintainer for the authz taglib. I need some help to reproduce the problem.
I currently have the following test case, which passes:
Code:
public void testAllowsAccessToCustomGrantedAuthorityImplementation()
throws Exception {
currentUser = new TestingAuthenticationToken("abc", "123",
new GrantedAuthority[] {
new CustomGrantedAuthority("ROLE_ADMIN")});
authorizeTag.setIfAllGranted("ROLE_ADMIN");
assertEquals("allows request - principal has ROLE_ADMIN",
Tag.EVAL_BODY_INCLUDE, authorizeTag.doStartTag());
}
public static final class CustomGrantedAuthority
extends GrantedAuthorityImpl {
public CustomGrantedAuthority(String role) {
super(role);
}
public boolean equals(Object other) {
return getAuthority().equals(((GrantedAuthority)other).getAuthority());
}
public int hashCode() {
return 1 + super.hashCode();
}
}
Notice hashCode() is returning a different value than GrantedAuthorityImpl. equals() is a bit different. I'm having a hard time reproducing your error, following your description. Could you post your equals() and hashCode() methods ? That would help me determine how to test the taglib.
Thanks !
François