質問

GlassfishでJAAを使用して、Active Directoryに対してWebアプリケーションで認証と承認を処理しようとしています。まず、広告に正常に接続し、セットアップを行っているユーザーとグループに対して認証できるPojoプログラムをいくつか作成しました。そのため、Webアプリケーション内で使用しているユーザー名、パスワード、およびグループが正しいと確信しています。

私はフォローしています このチュートリアル ガラス魚の領域をセットアップして、WebApp内の認証と承認を処理します。 Web.xmlとsun-web.xmlをデータで変更しました。

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>myapp</display-name>
<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
  <auth-method>FORM</auth-method>
  <realm-name>activedirectory</realm-name>
  <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/error.html</form-error-page>
  </form-login-config>
</login-config>
<security-role>
  <role-name>authorized</role-name>
</security-role>
<security-constraint>
  <display-name>Security</display-name>
  <web-resource-collection>
  <web-resource-name>Secured</web-resource-name>
  <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>authorized</role-name>
  </auth-constraint>
  <user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
  </user-data-constraint>
</security-constraint>
</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>/myapp</context-root>
  <security-role-mapping>
<role-name>authorized</role-name>
<group-name>Test</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>

私の領域

name: activedirectory
class name: com.sun.enterprise.security.auth.realm.ldap.LDAPRealm
JAAS context: ldapRealm
Directory: ldap://myADServersIPAddress:389
Base DN:   DC=myAD,DC=com
search-filter             (&(objectClass=user)(userPrincipalName=%s))
search-bind-password      fakepasswordhere
group-search-filter       (&(objectClass=group)(member=%d))
search-bind-dn            DN=Administrator

ログインするとログに入るエラーメッセージが失敗します

Login failed: javax.security.auth.login.LoginException:  
javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-
0C090290, comment: AcceptSecurityContext error, data 525, v893]

エラーコード「データ525」についていくつかの調査を行いましたが、明らかにユーザー名が無効であることを意味します。私は有効であることがわかっているIDとパスワードを使用しており、sun-web.xmlで定義されている「テスト」のメンバーであることがわかっています。現在の設定でsamaccountnameフォーム(ドメイン username)を使用して、userprincipal形式(username@domain)を試しました。また、私の領域の検索フィルターを変更して、samaccountnameを使用してuserprincipalnameを使用しましたが、両方のコンボを使用しても機能しませんでした。誰かが手がかりや提案を持っていますか?私は研究をしたように感じます、そして私は非常に近いですが、この時点で非常に立ち往生しています。誰かが実際にこれをすべて読むのに時間がかかってくれてありがとう!

役に立ちましたか?

解決

私が実際にテストするのは、dn =管理者に基づいて検索しているので、ルックアップ資格情報かもしれません。検索バインドDNの管理者アカウントに完全なDNを提供してみましたか?通常、デフォルトではそうします DN=Administrator, CN=Users, DC=myAD, DC=com 上記の情報に基づいています。

他のヒント

私はRewに同意します - 私の検索バインド-DNは、検索バインドIDが機能するために完全に資格を持たなければなりませんでした。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top