配置Web 应用程序的安全功能

本文详细解析了web.xml文件中的security-constraint元素配置,包括如何配置应用程序需要保护的资源、指定角色访问权限、登录方式等关键信息。

web.xml描述配置实例:

<!-- 配置应用程序需要保护的资源与什么角色可以访问资源 --> < security - constraint > < web - resource - collection > < web - resource - name > Admin Arew </ web - resource - name > < url - pattern > /* </url-pattern> </web-resource-collection> <auth-constraint> <role-name>tomcat</role-name> <!-- 具体的用户角色,请参阅Tomcat/conf/tomcat-users.xml配置文件 --> </auth-constraint> </security-constraint> <!-- 注册可以访问保护资源的角色(Tomcat中配置了tomcat、manager两个角色 --> <security-role> <role-name>tomcat</role-name> <role-name>manager</role-name> </security-role> <!-- 设置登录方式 --> <login-config> <auth-method>BASIC</auth-method> <realm-name>User Basic Authentication</realm-name> </login-config>

转载于:https://my.oschina.net/itsuifeng/blog/85494

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值