我有一個在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