J2EE安全之Http基本验证
来源:互联网 发布:制作艺术相册软件 编辑:程序博客网 时间:2024/05/21 00:55
http基本验证也是常用保障j2ee程序安全的重要验证方式之一.
下面小结一下.
以tomcat的admin角色为例.
tomcat-users.xml代码如下:
- <?xml version='1.0' encoding='utf-8'?>
- <tomcat-users>
- <role rolename="tomcat"/>
- <role rolename="role1"/>
- <role rolename="manager"/>
- <role rolename="admin"/>
- <user username="tomcat" password="tomcat" roles="tomcat"/>
- <user username="role1" password="tomcat" roles="role1"/>
- <user username="both" password="tomcat" roles="tomcat,role1"/>
- <user username="admin" password="admin" roles="admin,manager"/>
- </tomcat-users>
若想将web项目中的/root目录下的资源只对admin角色开放.可如下配置项目的web.xml文件
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>zgx</web-resource-name>
- <url-pattern>/root/*</url-pattern>
- <http-method>POST</http-method>
- <http-method>GET</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>admin</role-name>
- </auth-constraint>
- <user-data-constraint>
- <transport-guarantee>NONE</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
- <security-role>
- <role-name>admin</role-name>
- </security-role>
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>zgx</realm-name>
- </login-config>
这样,访问/root目录下的文件时,需要提供admin用户名和密码.
- J2EE安全之Http基本验证
- Webserives安全之HTTP验证
- ASP.NET Web API(二):安全验证之使用HTTP基本认证
- ASP.NET Web API:安全验证之使用HTTP基本认证
- python http基本验证
- J2EE之验证码实现
- Nginx设置HTTP基本验证
- Gerrit2启用HTTP基本验证
- 《pro Spring》学习笔记之Spring HTTP 远程方法调用集成Tomcat实现安全验证
- HTTP安全验证机制和Spring Security
- struts2之基本验证
- webservice安全之数字证书验证
- 基本的安全和HTTP认证
- 基于HTTP的基本安全认证机制
- 前端学HTTP之安全HTTP
- Spring Security的HTTP基本验证示例
- 数据安全验证之正则表达式
- 数据安全验证之正则表达式
- 组件技术
- Series 60第三版上提取消息的附件
- XML网络资源汇集
- ASP.NET上传图片,服务器端验证,宽度,高度,文件类型,尺寸,文件大小,图片上传,图片格式检查
- velocityEngine路径问题
- J2EE安全之Http基本验证
- BSS段、数据段、代码段、堆与栈
- 揭示常见的重构误区
- Item editor examples
- 《贼幸福》
- 爆笑郭德纲语录
- bss段和.data段的区别
- oracle序列的使用
- Create & delete user accounts from the command line on Mac OS X