Tomcat Basic Authentication
2014-01-07 22:51
246 查看
Add authen role and account
Config in tomcat-users.xml<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="authenRole"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,authenRole"/> <user username="authenRole_userName" password="authenRolePassword" roles="authenRole"/> </tomcat-users>
Effective authen role and account by Database Realm
Config in server.xml<GlobalNamingResources> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources>
Mapping in program
Config in web.xml<security-constraint> <web-resource-collection> <web-resource-name></web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>authenRole</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>Basic Authentication Area</realm-name> </login-config>
相关文章推荐
- Tomcat WebSocket basic authentication
- Tomcat配置Basic Authentication
- How do I use Form authentication with Tomcat?
- python Basic Authentication
- Http Basic Authentication has some limitations, maybe nginx could do some help...
- Basic access authentication
- htpasswd - Manage user files for basic authentication
- 访问需要HTTP Basic Authentication认证的资源的各种语言的实现
- 访问需要HTTP Basic Authentication认证的资源的各种语言的实现
- HTTP认证模式:Basic and Digest Access Authentication
- Http Basic Authentication 的请求头Authorization的状态保存问题:见‘斜粗下划线’部分说明
- 使用装饰器实现一个简单的Tornado用户认证Demo(Basic authentication on Tornado with a decorator)
- [转]OData and Authentication – Part 6 – Custom Basic Authentication
- python模拟登录http basic authentication网站
- Develop Web Service With Axis2 #9 - HTTP Basic Authentication in Weblogic
- configure JDBCRealm JAAS for mysql and tomcat 7 with form based authentication--reference
- BASIC HTTP AUTHENTICATION ON ANDROID
- HTTP Basic Authentication认证方式和AFNetworking的header的设置
- RFC2617-HTTP Authentication: Basic and Digest Access Authentication
- Basic HTTP authentication and Webdriver