I am deploying Roller (currently using development trunk) to an
intranet. The intranet uses Apache2 connected to Tomcat 5.5 via
mod_jk. The site is served up over https and protected by basic auth
using OpenLDAP for authentication. I have configured the Acegi
security.xml to use the OpenLDAP server as described in the
documentation.
I had trouble with AuthoritiesPopulator throwing a ClassCastException
and had to make the following patch with which initial user
authentication now works fine. It looks like the code assumed that
UserManager.getRoles() returned List<UserRole> but it returns
List<String>.
Index: apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/
security/AuthoritiesPopulator.java
===================================================================
--- apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/
security/AuthoritiesPopulator.java (revision 661721)
+++ apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/
security/AuthoritiesPopulator.java (working copy)
@@ -30,7 +30,6 @@
import org.apache.roller.weblogger.business.Weblogger;
import org.apache.roller.weblogger.business.WebloggerFactory;
import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.UserRole;
import org.springframework.util.Assert;
@@ -70,8 +69,8 @@
GrantedAuthority[] authorities = new
GrantedAuthorityImpl[roleCount];
int i = 0;
for (Iterator it = roles.iterator(); it.hasNext();) {
- UserRole role = (UserRole) it.next();
- authorities[i++] = new
GrantedAuthorityImpl(role.getRole());
+ String role = (String) it.next();
+ authorities[i++] = new GrantedAuthorityImpl(role);
}
if (defaultRole != null) {