シナリオ
Weblogic Server 10.3.4 を使用して、アプリケーションを使用する前にユーザーにサインインを要求するためにセキュリティ制約が有効になっている webapp を実行しています。ユーザーとグループの情報はアプリケーション データベースに常駐し、認証は WLS (コンテナー) によって処理されます。
このブログ記事 で説明されているようにデータベース スキーマをセットアップし、WLS コンソールで新しいセキュリティ レルム「app.realm」をセットアップし、そのSQLAuthenticator
中に を定義しました。
WLS を再起動した後、WLS Web コンソールの「app.realm」のデータベースからユーザーとグループの定義を確認できます。認証しようとしているユーザーはグループのメンバーですWEBAPP_USER
(WLS コンソールのユーザーの詳細ページにグループ メンバーシップが表示されます)。
アプリケーションをデプロイし (標準設定を使用し、WLS Web コンソールで調整を行わない)、保護された URL を呼び出すと、login.html
期待どおりにフォームにリダイレクトされます。ただし、何を試しても、(正しい)パスワードを入力すると、常に認証に失敗し、login_error.html
ページに移動します。デバッグの目的で、 でプレーン テキストのパスワードを有効にしたSQLAuthenticator
ので、適切な資格情報を使用したことは間違いありません。
これらの 2 つのスレッドは既に見ましたが、どちらも私の問題を解決していないようです。
更新 1
emzy のコメントのおかげで、WLS がデフォルト レルム「myrealm」に対して資格情報をチェックし、組み込み LDAP に対してログイン ユーザー名を解決しようとしていることがわかりました。
...
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <getDNForUser search("ou=people,ou=myrealm,dc=nvs_dev", "(&(uid=app.user)(objectclass=person))", base DN & below)>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <DN for user app.user: null>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <returnConnection conn:LDAPConnection { ldapVersion:2 bindDN:""}>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1303284573151> <BEA-000000> <javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User app.user denied
at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:229)
at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
at java.security.AccessController.doPrivileged(Native Method)
...
更新 2
これらの手順を実行して、認証を機能させました。
SQLAuthenticator
WLS コンソールのデフォルト レルム「myrealm」に を追加します。- それぞれのプロバイダー設定でWeblogic
DefaultAuthenticator
と新しいSQLAuthenticator
の両方をSUFFICIENT
設定します(「JAAS制御フラグ」と呼ばれます) - WLS を再起動する
ただし、1 つの疑問が残ります。
質問
<domain>/server/AdminServer/logs
WLS には、何が起こったかを確認できるフォルダ内の標準のログ ファイル以外に、追加のログ記録がありますか?何が間違っているのですか / フォームベースの認証をアプリケーションで機能させるには、パズルのどの部分が欠けていますか?- my で "app.realm" を明示的に指定しているのに、WLS が認証に "myrealm" を使用するのはなぜ
web.xml
ですか?
ここに私の設定の詳細があります:
web.xml
...
<security-constraint>
<web-resource-collection>
<web-resource-name>Webapp Platform</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>app-realm</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/login_error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Standard user</description>
<role-name>USER</role-name>
</security-role>
...
weblogic.xml
<wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app.xsd">
...
<security-role-assignment>
<role-name>USER</role-name>
<principal-name>WEBAPP_USER</principal-name>
</security-role-assignment>
</wls:weblogic-web-app>
login.html
<html>
<head>
<title>Login</title>
</head>
<body>
<form method="POST" action="j_security_check">
<table>
<tr><td>Username:</td><td><input type="text" name="j_username"></td></tr>
<tr><td>Password:</td><td><input type="password" name="j_password"></td></tr>
<tr><td colspan=2 align=right><input type=submit value="Submit"></td></tr>
</table>
</form>
</body>
</html>