標題: 請教一個關于tomcat認證的問題! [打印本頁] 作者: 小小跳蚤 時間: 2007-04-30 12:44 標題: 請教一個關于tomcat認證的問題! 在tomcat中配置了三個虛擬主機器,分別為www.a.comwww.b.comwww.c.com
三個虛擬主機的目錄分別為
/usr/local/htdocs/www.a.com/
/usr/local/htdocs/www.b.com/
/usr/local/htdocs/www.c.com/
現(xiàn)在的需求是只對www.a.com做基礎認證
但是在web.xml中添加以下信息后,所有的虛擬主機都做了認證,
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- NOTE: This role is not present in the default users file -->
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Access Control!Please Enter Uername And Passwd</realm-name>
</login-config>
</web-app>