users@glassfish.java.net

LDAP Authentication

From: <glassfish_at_javadesktop.org>
Date: Wed, 30 Apr 2008 13:03:38 PDT

Hi,

  I'm having a problem to retrieve the value for request.getUserPrincipal().getName(). It always return a null value. I used the similar configuration in Sun App Server 7 and I don't have this problem. Here is my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    <security-constraint>
        <display-name>Restricted Area</display-name>
        <web-resource-collection>
            <web-resource-name>Restricted Area</web-resource-name>
            <description/>
            <url-pattern>/ldap/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>Users</role-name>
            </auth-constraint>
        </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>ldap</realm-name>
        <form-login-config>
            <form-login-page>/logon.jsp</form-login-page>
            <form-error-page>/ldap_error.jsp</form-error-page>
            </form-login-config>
        </login-config>
    <security-role>
        <description>All Users</description>
        <role-name>Users</role-name>
    </security-role>
    </web-app>


sun-web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
  <context-root>/ldap</context-root>
  <security-role-mapping>
    <role-name>Users</role-name>
    <group-name>*</group-name>
  </security-role-mapping>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>
</sun-web-app>


Is this a bug in Glassfish V2? Thanks for any help!

Regards,

Johnny
[Message sent by forum member 'tanww888' (tanww888)]

http://forums.java.net/jive/thread.jspa?messageID=272298