- 下载cas-server-4.0-releaes解压modules下cas-server-webapp到tomcat webapps 改名cas方便一些。
2. 暂时不需要https协议,修改以下2处 cookieSecure=false
spring-configuration/ticketGrantingTicketCookieGenerator.xml
spring-configuration/warnCookieGenerator.xml
在deployerConfigContext.xml 添加
<bean id="proxyAuthenticationHandler" class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" p:httpClient-ref="httpClient" p:requireSecure="false" />
3 . 默认的采用固定的应户名登陆,替换JDBC验证用户
在deployerConfigContext.xml
<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager"> <constructor-arg> <map> <entry key-ref="searchModeSearchDatabaseAuthenticationHandler" value-ref="primaryPrincipalResolver" /> </map> </constructor-arg>
删除默认的map里验证方式,添加一个searchModeSearchDatabaseAuthenticationHandler
<bean id="searchModeSearchDatabaseAuthenticationHandler" class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler"> <property name="dataSource" ref="dataSource"></property> <property name="fieldUser" value="name"></property> <property name="fieldPassword" value="pass"></property> <property name="tableUsers" value="userinfo"></property> <property name="passwordEncoder" ref="MD5PasswordEncoder" ></property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/test" /> <property name="username" value="root" /> <property name="password" value="123456" /> </bean>
4.在WEB-INF\view\jsp\default下面找到casLogoutView.jsp--cas默认登陆页面
casGenericSuccess.jsp--默认登陆成功页面
可以根据自己风格设计页面,注意一些登陆页面上的隐藏域。