tomcat启用 BASIC authentication,使用数据库身份认证,口令MD5加密
2016-10-18 15:56
337 查看
准备数据库:
表名
users
列名 值
username user11
password 698d51a19d8a121ce581499d7b701668
是口令111的MD5 32位 http://md5jiami.51240.com/
表名
users-roles
列名 值
username user11
rolename roles22
===================================================================================
修改apache的配置文件,启用JDBC数据库Realm,支持MD5 digest加密口令
D:\apache-tomcat-7.0.62\conf\context.xml
修改apache的例子应用examples,使用 BASIC身份认证,角色roles22的用户可以访问/jsp/security/protected/* 资源
web.xml 修改为BASIC,role改一个为roles22
copy mysql-connector-java-5.1.34-bin.jar to
D:\apache-tomcat-7.0.62-authentication-mysql\lib
浏览器访问URL,输入用户名口令user11/111进行身份认证
http://localhost:8088/examples/jsp/security/protected/
表名
users
列名 值
username user11
password 698d51a19d8a121ce581499d7b701668
是口令111的MD5 32位 http://md5jiami.51240.com/
表名
users-roles
列名 值
username user11
rolename roles22
===================================================================================
修改apache的配置文件,启用JDBC数据库Realm,支持MD5 digest加密口令
D:\apache-tomcat-7.0.62\conf\context.xml
<Realm className="org.apache.catalina.realm.JDBCRealm" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://xxxxxx:3306/spiis" connectionName="root" connectionPassword="1q2w3e4r" userTable="users" userNameCol="usercode" userCredCol="password" userRoleTable="users-roles" digest="MD5" roleNameCol="rolename"/>
修改apache的例子应用examples,使用 BASIC身份认证,角色roles22的用户可以访问/jsp/security/protected/* 资源
web.xml 修改为BASIC,role改一个为roles22
<auth-constraint> <!-- Anyone with one of the listed roles may access this area --> <role-name>tomcat</role-name> <role-name>roles22</role-name> </auth-constraint> </security-constraint> <!-- Default login configuration uses form-based authentication --> <login-config> <auth-method>BASIC</auth-method> <realm-name>Example Form-Based Authentication Area</realm-name> </login-config> <!-- Security roles referenced by this web application --> <security-role> <role-name>roles22</role-name> </security-role> <security-role> <role-name>tomcat</role-name> </security-role>
copy mysql-connector-java-5.1.34-bin.jar to
D:\apache-tomcat-7.0.62-authentication-mysql\lib
浏览器访问URL,输入用户名口令user11/111进行身份认证
http://localhost:8088/examples/jsp/security/protected/
相关文章推荐
- 数据库使用sqlserver身份认证无法登陆
- Spring Security进阶身份认证之使用数据库中的用户进行身份认证(附源码)
- 使用Tomcat 连接池 连接数据库的实例
- Spring使用tomcat连接oracle的数据库连接池
- 使用HttpMoudle和IPrincipal实现自定义身份及权限认证
- 使用HttpMoudle和IPrincipal实现自定义身份及权限认证
- 使用Openssl为Tomcat配置SSL(双向认证)
- 用户身份认证(Authenticate),并将用户输入的信息与数据库进行判断
- 在Azure平台上使用托管卡进行身份认证
- 在Tomcat 5.5 中使用 LDAP 进行用户认证
- 使用Tomcat-5.5.20配置数据库连接池详细介绍
- 使用HttpMoudle和IPrincipal实现自定义身份及权限认证
- [转贴]突破2k,xp的身份认证使用电脑
- 如何让tomcat bundle liferay使用不同的数据库
- 使用Tomcat-5.5.20配置数据库连接池详细介绍
- 使用JNDI配置Tomcat数据源[提高访问数据库效率]
- 无法在web服务器上启动调试。调试失败,因为没有启用集成windows身份认证
- 在Tomcat配置和使用数据库资源(DataSource)
- 使用Tomcat-5.5.20配置数据库连接池详细介绍
- 使用HttpMoudle和IPrincipal实现自定义身份及权限认证