セキュリティレルムをGlassFish 4からWildFly 10にマイグレーションしようとしています(this guide)。JDBCセキュリティレルムをWildFlyに移行する
私がしている:
- は
java:/RemindersDS
としての私のデータソースを設定し、それが働いている検証。次のように自分のドメインを設定し :
<security-domain name="RemindersDomain" cache-type="default"> <authentication> <login-module code="Database" flag="required"> <module-option name="dsJndiName" value="java:/RemindersDS"/> <module-option name="principalsQuery" value="SELECT password FROM Authentication WHERE username = ?"/> <module-option name="rolesQuery" value="SELECT rolename, 'Roles' FROM User_roles WHERE username = ?"/> <module-option name="hashAlgorithm" value="SHA-256"/> <module-option name="hashEncoding" value="BASE64"/> </login-module> <login-module code="RoleMapping" flag="required"> <module-option name="rolesProperties" value="file:${jboss.server.config.dir}/reminders-domain.properties"/> <module-option name="replaceRole" value="false"/> </login-module> </authentication> </security-domain>
は、上記のクエリを検証しました。私のjboss-web.xmlのに追加
<security-domain>RemindersDomain</security-domain>
user=user admin=admin,user
:
は、次の内容の設定ディレクトリ内reminders-domain.propertiesファイルを追加しました。
は私のweb.xmlに以下を追加しました:
<security-constraint> <display-name>Update and delete users</display-name> <web-resource-collection> <web-resource-name>Users</web-resource-name> <description/> <url-pattern>/api/users/*</url-pattern> <http-method>PUT</http-method> <http-method>DELETE</http-method> </web-resource-collection> <auth-constraint> <description/> <role-name>admin</role-name> <role-name>user</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>RemindersDomain</realm-name> </login-config> <security-role> <description/> <role-name>admin</role-name> </security-role> <security-role> <description/> <role-name>user</role-name> </security-role>
アプリケーションが正常に配備し、私は拘束された要求を実行しようとするたびに、私は401不正な応答を取得します。私はこれらの要求を送信するためにPostmanを使用しています(HTTP基本認証のヘッダを生成します)。
私はここで何が欠けていますか?この問題をデバッグするにはどうすればよいですか? WildFlyのログに問題が報告されていません。
より良いロギングのために、セキュリティドメインのデバッグレベルをtrueに設定できます。とにかく問題が解決されたように見えます。 – ozOli