标签:
a) 创建数据库:sso
b) 创建用户表并初始化用户
1
2
3
4
5
6
7
8
9
10
11
|
CREATE TABLE `app_user` ( `username` varchar (30) NOT NULL default ‘‘ , ` password ` varchar (45) NOT NULL default ‘‘ , PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 并添加如下用户: INSERT INTO `app_user` (`username`,` password `) VALUES ( ‘test‘ , ‘111‘ ), ( ‘user‘ , ‘222‘ ), ( ‘tom‘ , ‘333‘ ), ( ‘jim‘ , ‘000‘ ); |
1
2
3
4
5
6
7
8
|
<!-- <bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" /> --> < bean class = "org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler" > < property name = "sql" value = "select password from app_user where username=?" /> < property name = "dataSource" ref = "dataSource" /> </ bean > |
b)、beans节点下添加bean:dataSource
1
2
3
4
5
6
|
< bean id = "dataSource" class = "org.springframework.jdbc.datasource.DriverManagerDataSource" > < property name = "driverClassName" >< value >com.mysql.jdbc.Driver</ value ></ property > < property name = "username" >< value >root</ value ></ property > < property name = "password" >< value >123456</ value ></ property > </ bean > |
5、重启tomcat
cd /bin ./shutdown.sh ./startup.sh
6、登录服务器:使用3.b步中插入的
三、可能遇到的问题:
1、登录时提示:Non-Secure-Connection
解决方法:注销相关代码即可
2、账号密码正确但是一直报验证错误:重启tomcat即可
标签:
原文地址:http://www.cnblogs.com/gossip/p/5662524.html