我有一个在Netbeans的(6.8)开发和(6)使用LDAP(活动目录)在Tomcat中工作正常,一个简单的web应用程序。从Tomcat转换LDAP到GlassFish
我需要将其转换为EE(JSF2),所以我正在从Tomcat移动到GlassFish(v3)。
我已经改变了网页文件,XHTML和配置的XML文件。但是,我无法获取GlassFish LDAP配置进行身份验证。
我附加了旧的web.xml和server.xml(来自Tomcat)片段以及新的web.xml,sun-web.xml和GlassFish配置的各个部分。
如果有人可以帮我找出我在哪里丢失了一块将允许用户进行身份验证,我将不胜感激。 (顺便说一下,我不使用角色,只是对LDAP数据库进行身份验证已经足够了。)
现在,我的应用程序会提示我输入用户,当我尝试访问'受保护的文件'区域,GlassFish服务器在未通过身份验证时会引发异常。因为它在Tomcat下工作,所以我知道我有正确的信息,我只是不知道如何格式化它以让GlassFish传递它。
谢谢。
TOMCAT FILES: - Tomcat的server.xml中:
的web.xml:
<web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <description>Authentication Required</description> <url-pattern>/faces/protected/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint>
*
BASIC 请输入您的用户名和密码:
GLASSFISH FILES: (我启用了安全性面板上的安全管理器,默认领域设置'LDAPRealm',并添加了“-Djava.naming.referral = follow”JVM选项。) - domain.xml:
<auth-realm name="certificate" classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" />
<auth-realm classname="com.sun.enterprise.security.auth.realm.ldap.LDAPRealm" name="LdapRealm">
<property description="()" name="search-bind-password" value="xxxxxxxx" />
<property description="()" name="search-bind-dn" value="cn=xxxxxxxx,ou=Administrators,ou=Information Technology,ou=ITTS,ou=Administrative,ou=xxx,dc=xxxxxx,dc=xxx" />
<property name="jaas-context" value="ldapRealm" />
<property name="base-dn" value="ou=xxx,dc=xxxxxx,dc=xxx" />
<property name="directory" value="ldap://xxxx.xxxxxx.xxx:389" />
<property name="search-filter" value="(&(objectClass=user)(sAMAccountName=%s))" />
</auth-realm>
-web.xml:
<security-constraint>
<display-name>protected</display-name>
<web-resource-collection>
<web-resource-name>ProtectedArea</web-resource-name>
<description/>
<url-pattern>/faces/protected/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description/>
<role-name>*</role-name>
</security-role>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>LDAPRealm</realm-name>
<form-login-config>
<form-login-page>/faces/login.xhtml</form-login-page>
<form-error-page>/faces/loginError.xhtml</form-error-page>
</form-login-config>
</login-config>
太阳网。XML:
这里是它抛出异常:
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)
不是真的有关NB的问题... – vkraemer 2010-05-11 14:54:26
我很困惑你的评论。我没有把它标记为NB问题,我只提到我使用NB作为IDE。 我通过你的个人资料看到你对gf有一定的了解。你能提供任何有关我在这里失踪的信息吗?谢谢。 – Jon 2010-05-12 11:44:12