2 Replies Latest reply on Feb 19, 2006 12:51 PM by Scott Stark

    how can i use JNDIRealm with JBoss?

    F B Newbie

      Any help much appreciated!!

      I am trying to use JNDIRealm so that I can authenticate (user) logins against user data stored in an LDAP server (Sun One v5.2) - but am not making much progress. I am also using a security-filter and the web-app operates over HTTPS

      I think I have must have misconfigured but don't know where/what- if anyone can spot anything, that would be great!

      My configuration files appear as follows:
      [from securityfilter-config.xml in my WAR's WEB-INF]

      Standard User

      <realm-param name="connectionURL" value="ldap://mymachine.mycompany.com:389"/>
      <realm-param name="userPattern" value="uid={0},ou=people,dc=dataduct,dc=com"/>
      <realm-param name="roleBase" value="ou=groups,dc=dataduct,dc=com"/>
      <realm-param name="roleName" value="cn"/>
      <realm-param name="roleSearch" value="(uniqueMember={0})"/>
      <realm-param name="contextFactory" value="com.sun.jndi.ldap.LdapCtxFactory"/>

      [my ref to the securityfilter-config in web.xml - again in WAR's WEB-INF]

      <filter-name>Security Filter</filter-name>
      Configuration file location
      Validate config file if set to true

      <!-- map all requests to the SecurityFilter, control what it does with configuration settings -->
      <filter-name>Security Filter</filter-name>

      [and the part of server.xml on that refs to HTTPS]
      <!-- SSL/TLS Connector configuration using the admin devl guide keystore -->

      The problem is manifesting itself when I deploy the my WAR file (I am using Struts 1.2.7 & Tomcat 5.5 bundled in JBoss 4.0.2) - JBoss reports an InvocationTargetException

      2006-02-15 12:39:25,562 DEBUG [org.jboss.web.tomcat.filters.ReplyHeaderFilter] Adding header name: X-Powered-By='Servlet 2.4; JBoss-4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)/Tomcat-5.5'
      2006-02-15 12:39:26,078 ERROR [org.apache.commons.digester.Digester] End event threw exception
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      Caused by: java.lang.ClassCastException: org.apache.catalina.realm.JNDIRealm
      at org.securityfilter.config.SecurityConfig.addRealm(SecurityConfig.java:227)
      ... 141 more
      2006-02-15 12:39:26,140 INFO [STDOUT] unable to parse input: java.lang.ClassCastException: org.apache.catalina.realm.JNDIRealm

      Many Thanks!