シンプルな Web アプリケーションに websphere 7 ファイルベースの基本セキュリティを使用しています。私のアプリケーションには、1.Add Partner 2.List Partner という 2 つの画面が含まれています。このために、1.AddPartner 2.ListPartner という 2 つのロールを作成しました。この 2 つのロールを異なるユーザー名とパスワードでマップしました。ユーザーが AddPartner リンクをクリックすると、ListPartner リンクの場合と同様に、資格情報を要求する必要があります。以下は私のweb.xmlエントリです(私はstrut2規約を使用しています)
<security-constraint>
<web-resource-collection>
<web-resource-name>servicepartner</web-resource-name>
<url-pattern>/add-partner</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>AddPartner</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>servicepartner</web-resource-name>
<url-pattern>/list-partner</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ListPartner</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>AddPartner</role-name>
</security-role>
<security-role>
<role-name>ListPartner</role-name>
</security-role>
ただし、AddPartner では機能しますが、ListPartner リンク アプリケーションをクリックすると、AddPartner 資格情報をチェックするため、403 禁止エラーがスローされます。サーバー コンソールで以下のエラーが表示されます。
Authorization failed for user commonuser:defaultWIMFileBasedRealm while invoking GET on default_host:/serviceapp/list-partner, Authorization failed, Not granted any of the required roles: ListPartner
単一のアプリケーションで異なる資格情報を確認することは可能ですか?助けてください.