cas3.4.3.1部署
下載安裝
1、OS、JDK、TOMCAT安裝略
2、CAS Server:
a.下載:wget http://downloads.jasig.org/cas/cas-server-3.4.3.1-release.tar.gz
b.解壓:tar xzvf cas-server-3.4.3.1-release.tar.gz
c.安裝:cp cas-server-3.4.3.1/modules/cas-server-webapp-3.4.3.1.war $TOMCAT_HOME/webapps/cas.war
d.啟動:啟動tomcat
3、測試CAS Server:
訪問http://serverip:8080/cas,默認驗證方式為用戶名和密碼一致即通過
數據源配置
CAS默認設置為只要用戶名和密碼相同,即可進行登錄,這在現實使用中是不允許的。下面介紹如何修改cas數據源
1、編輯CAS Server的配置文件(webapps/cas/WEB-INF/deployerConfigContext.xml)屏蔽原有驗證方法:(注釋掉該行)
<bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />
2、加入通過訪問數據庫進行驗證的handler:
<bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="sql" value="select password from user where username=?" />
<property name="dataSource" ref="dataSource" />
<property name="passwordEncoder" ref="myPasswordEncoder" />
</bean>
3、加入一個數據庫連接的<bean>:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://192.168.1.37:3306/casuser"></property>
<property name="username" value="dbuser"></property>
<property name="password" value="dbpass"></property>
</bean> 這里的dataSource現在配置的是mysql,如果你們的應用中不是mysql,那就配置相應的數據源把。
4、如果password字段是MD5加密存儲的,可以再增加一個bean:
<bean id="myPasswordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
<constructor-arg value="MD5"/>
</bean>
通過以上步驟,cas服務器就部署好了。
1、OS、JDK、TOMCAT安裝略
2、CAS Server:
a.下載:wget http://downloads.jasig.org/cas/cas-server-3.4.3.1-release.tar.gz
b.解壓:tar xzvf cas-server-3.4.3.1-release.tar.gz
c.安裝:cp cas-server-3.4.3.1/modules/cas-server-webapp-3.4.3.1.war $TOMCAT_HOME/webapps/cas.war
d.啟動:啟動tomcat
3、測試CAS Server:
訪問http://serverip:8080/cas,默認驗證方式為用戶名和密碼一致即通過
數據源配置
CAS默認設置為只要用戶名和密碼相同,即可進行登錄,這在現實使用中是不允許的。下面介紹如何修改cas數據源
1、編輯CAS Server的配置文件(webapps/cas/WEB-INF/deployerConfigContext.xml)屏蔽原有驗證方法:(注釋掉該行)
<bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />
2、加入通過訪問數據庫進行驗證的handler:
<bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="sql" value="select password from user where username=?" />
<property name="dataSource" ref="dataSource" />
<property name="passwordEncoder" ref="myPasswordEncoder" />
</bean>
3、加入一個數據庫連接的<bean>:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://192.168.1.37:3306/casuser"></property>
<property name="username" value="dbuser"></property>
<property name="password" value="dbpass"></property>
</bean> 這里的dataSource現在配置的是mysql,如果你們的應用中不是mysql,那就配置相應的數據源把。
4、如果password字段是MD5加密存儲的,可以再增加一個bean:
<bean id="myPasswordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
<constructor-arg value="MD5"/>
</bean>
通過以上步驟,cas服務器就部署好了。
posted on 2011-04-11 09:57 汪長軍 閱讀(410) 評論(0) 編輯 收藏 所屬分類: cas單點登錄