1. 下载,安装。 cas server (http://www.jasig.org/cas/download )
解压缩后,看到以下文件:
focusbeijing@focusbeijing-desktop:/sg552/cas-server-3.4.11$ ls
assembly.xml cas-server-support-radius
cas.log cas-server-support-spnego
cas-server-core cas-server-support-trusted
cas-server-documentation cas-server-support-x509
cas-server-integration-berkeleydb cas-server-uber-webapp
cas-server-integration-jboss cas-server-webapp
cas-server-integration-memcached INSTALL.txt
cas-server-integration-restlet license.txt
cas-server-support-generic modules
cas-server-support-jdbc notice.txt
cas-server-support-ldap perfStats.log
cas-server-support-legacy pom.xml
cas-server-support-openid tasks.xml
2. 下载tomcat6, (保证你安装了JDK6+)解压缩:
focusbeijing@focusbeijing-desktop:/sg552/tomcat6$ ls
bin conf LICENSE NOTICE RELEASE-NOTES temp work
cas.log lib logs perfStats.log RUNNING.txt webapps
3. 设置JDK_HOME, CATALINA_HOME 系统变量:
export CATALINA_HOME=/sg552/tomcat6
4. 1. copy modules/cas-server-webapp- VERSION.war to Tomcat's webapps/ directory,
then start Tomcat by :
$CATALINA_HOME/bin/startup.sh
focusbeijing@focusbeijing-desktop:/sg552/tomcat6$ $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE: /sg552/tomcat6
Using CATALINA_HOME: /sg552/tomcat6
Using CATALINA_TMPDIR: /sg552/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk
Using CLASSPATH: /sg552/tomcat6/bin/bootstrap.jar
5. 访问:
http://localhost:8080/cas-server-webapp-3.4.11/login
就可以看到登录页面了。
https://wiki.jasig.org/display/CASUM/JDBC
使用JDBC认证: https://wiki.jasig.org/display/CASUM/JDBC
6, CAS 支持的9种方式:
Active Directory: 是面向Windows Standard Server、Windows Enterprise Server以及 Windows Datacenter Server的目录服务。
Generic: 通用醒
JAAS: java 自带的一种东东。
JDBC: 连接到数据库。
LDAP: LDAP协议。用于验证。
Legacy: 未知。。。
RADIUS:远程认证拨号用户系统。
SPNEGO: SPNEGO(SPNEGO: Simple and Protected GSS-API Negotiation)是微软提供的一种一种使用GSS- API认证机制的安全协议, 用于使Webserver共享Windows Credentials,它扩展了 Kerberos ( 一种网络认证协议)。
Trusted: 不清楚。。。
X.509 Certificates
X.509被广泛使用的数字证书标准,是由国际电联电信委员会( ITU-T)为单点登录(SSO-Single Sign-on)和授权管理基础设施(PMI- Privilege Management Infrastructure)制定的PKI标准。X. 509定义了(但不仅限于) 公钥证书 、证书吊销清单、 属性证书和证书路径验证算法等证书标准。
7. 开始使用JDBC 进行CAS的认证。
根据CAS INSTALL.TXT 文件的说明:
access the CAS login page by opening up a web browser and visiting:
36 http://hostname:8080/cas-server-webapp-VERSION/login (see note below)
37
38 You should see the CAS login page asking you for your username and
39 password. The default authentication plugin accepts NetID=password.
40 Enter in an identical value for NetID and password and click LOGIN.
41 If everything is set up correctly, you should see a page stating that
42 you've successfully logged into CAS. Congratulations!
这里的NETID 应该就是用户名。
这个用户名在哪里呢?应该就需要我们先配置JDBC数据库, 然后再把它加进去。
需要用 POM。XML ,来进行MVN生成一个新的APP。。。手动的方式不行, 会产生找不到 generic 验证的错误。
https://wiki.jasig.org/display/CASUM/Best+Practice+-+Setting+Up+CAS+Locally+using+the+Maven2+WAR+Overlay+Method
8. 需要安装 mvn package install (也可以直接在 module下找到对应的东西)
https://wiki.jasig.org/display/CASUM/Building+and+Deploying
As of CAS 3.1, CAS builds exclusively with the Maven 2 Build Management System. This system provides a common build and directory structure across all projects that use Maven 2 and defines common goals that can be applied to any project type (JAR, WAR, EAR, etc.).
In your CAS_HOME, you can type "mvn package install". This will create all of the jar and war files for the CAS modules. Alternatively, you can enter any of the CAS_HOME/{module} sub directories and execute "mvn package install" to generate just that particular JAR or WAR.
As compilation requires a network connection, if you are behind a http proxy, you have to indicate some extra option to mvn command: "mvn -Dhttp.proxyHost=xxx -Dhttp.proxyPort=xxx package install"
https://wiki.jasig.org/display/CAS/Examples+to+Configure+CAS
对于默认的CAS应用, 使用的是:最简单的验证( SimpleTestUsernamePasswordAuth enticationHandler)。 只要用户输入的用户名和密码相同就可以了。
见 WEB-INF/deployerConfigContext. xml
分别建立两个 app:
下载了。
继续使用 simpleauthenticationhandler. (用户名和密码一样)
0. 在 Gemfile中,加入:
gem 'rubycas-client'
CASClient::Frameworks::Rails::Filter.configure(
:cas_base_url => " http://192.168.56.10:8080/cas-server-webapp-3.4.11 "
)
before_filter CASClient::Frameworks::Rails::Filter
def class fish_controller
def logout
CASClient::Frameworks::Rails::Filter.logout(self)
end
end
match '/logout' => "fish#logout", :as => :logout
<div style="border: 1px solid green">
<%= session[:cas_user] %>
</div>
<% if session[:cas_user] %>
<%= link_to "logout" , logout_path %>
<% end %>
CASClient::Frameworks::Rails::Filter.logout(self)
)