0

シンプルな 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 

単一のアプリケーションで異なる資格情報を確認することは可能ですか?助けてください.

4

1 に答える 1

1


Web モジュールでアプリケーション セキュリティを使用するには、次の手順を実行する必要があります
。 1. WAS で「アプリケーション セキュリティ」を有効に
する必要があります。また、タグ<realm-name>defaultWIMFileBasedRealm</realm-name>の間などでレルム名を指定してください。 3. ロールはサブジェクト (ユーザー、グループ、またはすべての認証済みユーザーなどの特別なサブジェクトを「何らかの」レルムにマップする必要があります。これは、Rational Application Developer のいずれかで、application.xml (物理的に ibm-application- bnd.xmi) または指定されたデプロイ時間<login-config>

ここに画像の説明を入力

于 2013-07-22T08:21:08.817 に答える