Tomcat中的authorization的设置

主要是两个步骤:

第一步在tomcat-users.xml中加入
<tomcat-users>
    <role rolename="Admin"/>
    <user username="jack" password="jack" roles="Admin"/>
</tomcat-users>


第二步在该project中的web.xml加入:
(例子)
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>access</web-resource-name>//mandatory,可以任意取名
            <url-pattern>/app</url-pattern>
            <url-pattern>/*</url-pattern>

        </web-resource-collection>
        <auth-constraint>
            <role-name>Admin</role-name>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>//最基本的登陆信息对话框
    </login-config>

posted on 2007-11-09 16:33 刘铮 阅读(644) 评论(0)  编辑  收藏 所属分类: Tomcat


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

留言簿(1)

文章分类(141)

文章档案(147)

搜索

最新评论