- PR -

tomcat5 での、で、役割ごとに制限したい。

1
投稿者投稿内容
初心者
会議室デビュー日: 2005/01/06
投稿数: 3
投稿日時: 2005-01-07 20:25
tomcat でweb.xmlの内容を以下のように記述しました。
<security-constraint>
<web-resource-collection>
<web-resource-name>Basic Authenitication test1</web-resource-name>
<url-pattern>/jsp/secret/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>userdata</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>userdata</role-name>
</security-role>


<security-constraint>
<web-resource-collection>
<web-resource-name>Basic Authenitication test2</web-resource-name>
<url-pattern>/jsp/master/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>master</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>master</role-name>
</security-role>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>会員認証</realm-name>
</login-config>

やろうとしてるのは、BASIC認証で、2個ではなく1個ならちゃんと認証できます。
masterとuserdataのロールで入れるjspを分けたいと思っています。
JDBCレルムでデータベースとの接続は確認済みです。
なんかわかる方がいればお願いします。
環境
tomcat5.0.16
MySQL4.0.16
j2sdk1.4.2.03
aa
ぬし
会議室デビュー日: 2004/01/08
投稿数: 299
投稿日時: 2005-01-08 21:54
security-constraintを2つ続けて書いて、その後にsecurity-roleを2つ続けて書いてみてはいかがでしょうか。

ちなみに、web-app_2_3.dtdは次の通りです。

コード:
<!ELEMENT web-app (icon?, display-name?, description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*,
servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,
login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>



1

スキルアップ/キャリアアップ(JOB@IT)