CREATE DATABASE /*!32312 IF NOT EXISTS*/`cas` /*!40100 DEFAULT CHARACTER SET gbk */;USE `cas`;/*Table structure for table `user` */DROP TABLE IF EXISTS `user`;CREATE TABLE `user` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) NOT NULL,`password` varchar(255) NOT NULL,`used` tinyint(2) NOT NULL,PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=gbk;/*Data for the table `user` */insert into `user`(`id`,`name`,`password`,`used`) values (1,'casuser','9414f9301cdb492b4dcd83f8c711d8bb',1);
cas\WEB-INF\deployerConfigContext.xml1)更換驗證方式
<!--<bean id="primaryAuthenticationHandler"class="org.jasig.cas.authentication.AcceptUsersAuthenticationHandler"><property name="users"><map><entry key="casuser" value="Mellon"/></map></property></bean>--><!-- Define the DB Connection --><bean id="dataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource"p:driverClass="com.mysql.jdbc.Driver"p:jdbcUrl="jdbc:mysql://127.0.0.1:3306/cas?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"p:user="root"p:password="root" /><!-- Define the encode method--><!--<bean id="passwordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder" autowire="byName"> <constructor-arg value="MD5"/> </bean> --><bean id="passwordEncoder"class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"c:encodingAlgorithm="MD5"p:characterEncoding="UTF-8" /><bean id="dbAuthHandler"class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"p:dataSource-ref="dataSource"p:sql="select password from user where name=? and used=1"p:passwordEncoder-ref="passwordEncoder"/><!-- p:passwordEncoder-ref="passwordEncoder" -->2)更換驗證Handle
<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager"><constructor-arg><map><!--| IMPORTANT| Every handler requires a unique name.| If more than one instance of the same handler class is configured, you must explicitly| set its name to something other than its default name (typically the simple class name).--><entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" /><entry key-ref="dbAuthHandler" value-ref="primaryPrincipalResolver" /><!-- <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" /> --></map></constructor-arg>