2 Replies Latest reply on Feb 25, 2003 4:45 PM by chris bowen

    LdapLoginModule - seeking much needed assistance

    chris bowen Newbie

      For whatever reason (and there could be a number of them), After creating an instance of LdapLoginModule and calling method login(), I am getting a NullPointerException. I am not sure what I did wrong but here is a list of the files that I set up.

      login-config.xml
      ----------------
      <?xml version="1.0"?>
      <!DOCTYPE policy PUBLIC
      "-//JBoss//DTD JBOSS Security Config 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/security_config.dtd">


      <application-policy name="SunOneDirectory">

      <login-module flag="required" code="org.jboss.security.auth.spi.LdapLoginModule">
      <module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
      <module-option name="java.naming.provider.url">ldap://localhost:389/o=aebtest6.ca</module-option>
      <module-option name="java.naming.security.authentiaction">simple</module-option>
      <module-option name="java.naming.security.principal">ou=People,o=aebtest6.ca</module-option>
      <module-option name="java.naming.security.credentials">secret</module-option>
      <module-option name="principalDNPrefix">uid=</module-option>
      <module-option name="principalDNSuffix">,ou=People,o=aebtest6.ca</module-option>
      <module-option name="uidAttributeID">uid</module-option>
      <module-option name="roleAttributeID">cn</module-option>
      <module-option name="rolesCtxDN">cn=JBossSXTests,ou=Roles,o=aebtest6.ca</module-option>
      </login-module>

      </application-policy>
      </policy



      web-app
      -------


      <web-app>

      <servlet-name>Authentication</servlet-name> <servlet-class>ca.recursive.aeb.servlets.Authentication</servlet-class>
      <init-param>
      <param-name>properties</param-name>
      <param-value>/WEB-INF/conf/velocity.properties</param-value>
      </init-param>
      <init-param>
      <param-name>repositoryPath</param-name>
      <param-value>WEB-INF/authentication</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>

      <!-- end Authentication/Authorisation mappings -->
      <servlet-mapping>
      <servlet-name>Authentication</servlet-name>
      <url-pattern>/authentication</url-pattern>
      </servlet-mapping>

      <welcome-file-list>
      <welcome-file>authenticate.jsp</welcome-file>
      </welcome-file-list>


      <!-- tell the app server which authentication to use and where to
      find the login page -->

      <login-config>

      <!-- use this for form based authentication -->
      <auth-method>FORM</auth-method>
      <realm-name>java:jaas/SunOneDirectory</realm-name>

      <form-login-config>
      <form-login-page>authenticate.jsp</form-login-page>
      <form-error-page>loginerror.jsp</form-error-page>
      </form-login-config>

      <!-- end form based authentication -->
      </login-config>

      <!-- list the possible security roles -->
      <security-role>
      <role-name>jduke</role-name>
      </security-role>




      jboss-web.xml
      -------------

      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">
      <jboss-web>
      <!-- tell jboss what realm to use for authentication -->
      <security-domain>java:/jaas/SunOneDirectory</security-domain>
      </jboss-web>




      finally, the ldif file
      -------------------------------------

      # File: aebtest5.ldif

      # Root node
      dn: o=aebtest6.ca
      o: aebtest6.ca
      objectclass: top
      objectclass: organization

      dn: ou=People, o=aebtest6.ca
      ou: People
      objectclass: top
      objectclass: organizationalunit

      dn: ou=Roles, o=aebtest6.ca
      ou: Roles
      objectclass: top
      objectclass: organizationalUnit

      dn: uid=jduke, ou=People, o=aebtest6.ca
      uid: jduke
      cn: Java
      cn: Duke
      userPassword: theduke
      sn: jduke
      objectclass: person
      objectclass: inetOrgPerson


      dn: cn=JBossSXTests, ou=Roles, o=aebtest6.ca
      cn: JBossXSTests
      uid: jduke
      cn: TheDuke
      sn: tests
      objectclass: person
      objectclass: inetOrgPerson

      dn: cn=JBossSXTests, ou=Roles, o=aebtest6.ca
      cn: JBossSXTests
      uid: jduke
      cn: TheDuke
      cn: AnimatedCharacter
      sn: JBossSXTests
      objectclass: person
      objectclass: inetOrgPerson

      dn: cn=JBossSXTests, ou=Roles, o=aebtest6.ca
      cn: JBossSXTests
      userid: jduke
      cn: TheDuke
      cn: AnimatedCharacter
      sn: tests
      objectclass: person
      objectclass: inetOrgPerson