Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting LDAP from Tomcat to GlassFish
    primarykey
    data
    text
    <p>I have a simple web-app that is developed in Netbeans(6.8) and works fine in Tomcat(6) using LDAP(Active Directory).</p> <p>I need to convert this to an EE (JSF2), so I am moving from Tomcat to GlassFish(v3). </p> <p>I have changed the web files to xhtml and configured the xml files. However, I cannot get the GlassFish LDAP configuration to authenticate.</p> <p>I am attaching my old web.xml and server.xml (from Tomcat) snippets and the portions of the new web.xml, sun-web.xml, and the GlassFish configuration.</p> <p>If anyone can help me figure out where I am missing the piece that will allow a user to be authenticated, I would appreciate it. (btw, I am not using roles, just authenticating against the LDAP db is good enought.) </p> <p>As it is right now, my app will prompt me to enter a user when I try to access a file in the 'protected' area and the GlassFish server throws an exception when it fails to authenticate. Because it works under Tomcat, I know I have the right information, I just don't know how to format it to get GlassFish to pass it along.</p> <p>Thanks.</p> <p><strong>TOMCAT FILES:</strong> - Tomcat server.xml:</p> <p></p> <ul> <li><p>web.xml:</p> <p></p> <pre><code>&lt;web-resource-collection&gt; &lt;web-resource-name&gt;Protected Area&lt;/web-resource-name&gt; &lt;description&gt;Authentication Required&lt;/description&gt; &lt;url-pattern&gt;/faces/protected/*&lt;/url-pattern&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;role-name&gt;*&lt;/role-name&gt; &lt;/auth-constraint&gt; </code></pre> <p></p> <p> * </p> <p> BASIC Please enter your user name and password: </p></li> </ul> <p><strong>GLASSFISH FILES:</strong> (I enabled the Security Manager on the Security panel, set the Default Realm to 'LDAPRealm', and added "-Djava.naming.referral=follow" JVM options.) - domain.xml:</p> <pre><code>&lt;auth-realm name="certificate" classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" /&gt; &lt;auth-realm classname="com.sun.enterprise.security.auth.realm.ldap.LDAPRealm" name="LdapRealm"&gt; &lt;property description="()" name="search-bind-password" value="xxxxxxxx" /&gt; &lt;property description="()" name="search-bind-dn" value="cn=xxxxxxxx,ou=Administrators,ou=Information Technology,ou=ITTS,ou=Administrative,ou=xxx,dc=xxxxxx,dc=xxx" /&gt; &lt;property name="jaas-context" value="ldapRealm" /&gt; &lt;property name="base-dn" value="ou=xxx,dc=xxxxxx,dc=xxx" /&gt; &lt;property name="directory" value="ldap://xxxx.xxxxxx.xxx:389" /&gt; &lt;property name="search-filter" value="(&amp;amp;(objectClass=user)(sAMAccountName=%s))" /&gt; &lt;/auth-realm&gt; </code></pre> <p>-web.xml:</p> <pre><code> &lt;security-constraint&gt; &lt;display-name&gt;protected&lt;/display-name&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;ProtectedArea&lt;/web-resource-name&gt; &lt;description/&gt; &lt;url-pattern&gt;/faces/protected/*&lt;/url-pattern&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;description/&gt; &lt;role-name&gt;*&lt;/role-name&gt; &lt;/auth-constraint&gt; &lt;/security-constraint&gt; &lt;security-role&gt; &lt;description/&gt; &lt;role-name&gt;*&lt;/role-name&gt; &lt;/security-role&gt; &lt;login-config&gt; &lt;auth-method&gt;FORM&lt;/auth-method&gt; &lt;realm-name&gt;LDAPRealm&lt;/realm-name&gt; &lt;form-login-config&gt; &lt;form-login-page&gt;/faces/login.xhtml&lt;/form-login-page&gt; &lt;form-error-page&gt;/faces/loginError.xhtml&lt;/form-error-page&gt; &lt;/form-login-config&gt; &lt;/login-config&gt; </code></pre> <ul> <li><p>sun-web.xml:</p> <p> <em> </em> </p></li> </ul> <p>Here is the exception that it throws:</p> <pre><code>SEVERE: SEC1113: Exception in LdapRealm when trying to authenticate user. javax.security.auth.login.LoginException: javax.security.auth.login.LoginException: User yyyyyyy not found. at com.sun.enterprise.security.auth.realm.ldap.LDAPRealm.findAndBind(LDAPRealm.java:450) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload