Environmental Win8+tomcat7+jdk7+cas-server-4.0.0-release
1. First to http://downloads.jasig.org/address download cas-server-4.0.0-release.zip, unzip to modules directory Cas-server-webapp-4.0.0.war, copy to Tomcat's WebApp directory, modify the name to Cas.war
2. (1) Create a certificate
Keytool-genkey-alias mycas-keyalg rsa-keysize 2048-keystore e:/cas/keys/mycas.keystore
(2) Export certificate
Keytool-export-file E:/cas/keys/mycas.crt-alias Mycas-keystore E:/cas/keys/mycas.keystore
(3) Client JVM Import Certificate
Keytool-import-keystore E:\java\jdk1.7.0_79\jre\lib\security\cacerts-file E:/cas/keys/mycas.crt-alias Mycas
If prompted:
Keytool Error:java.io.IOException:Keystore was tampered with, or password was incorrect
Then enter the password: Changeit
This is because a keystore is created by default after the JDK is installed, with the password: Changeit
You can also delete E:\java\jdk1.7.0_79\jre\lib\security\cacerts when you enter the above command
3. Let Tomcat use the certificate
Open the Conf/server.xml file for the Tomcat directory at 8443 end, and set the Keystorefile, Keystorepass modify the results as follows:
<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol" maxthreads= "Max" sslenabled= "true" Scheme= "https" secure= "true" Clientauth= "false" sslprotocol= "TLS" keystorefile= "E:\cas\keys\mycas.keystore" keystorepass= "123456"/>
4. Log in to CAs
Start Tomcat and then WebApp in the Cas.war automatic decompression, we can directly access Https://localhost:8443/cas/login, cas4.0 default account password is Casuser/mellon
5. Read the database for authentication
The jar package that needs to have Cas-server-support-jdbc.jar C3p0-0.9.1.2.jar mysql-connector-java-5.1.24, I am here is mysq other database organizes jar package according to circumstance, Put into the webapps\cas\web-inf\lib. Then find Deployerconfigcontext.xml under Cas\web-inf to modify:
(1) First comment out the default login password:
<!--<bean id= "Primaryauthenticationhandler" class= " Org.jasig.cas.authentication.AcceptUsersAuthenticationHandler "> <property name=" Users "> <map> < Entry key= "Casuser" value= "Mellon"/> </map> </property> </bean>--
(2) After the comment, add the JDBC configuration, where encryption is not used for convenience:
<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" p:driverclass= "Com.mysql.jdbc.Driver" p : Jdbcurl= "jdbc:mysql://127.0.0.1:3306/test?useunicode=true&characterencoding=utf-8& Zerodatetimebehavior=converttonull "p:user=" root "p:password=" root "/><bean id=" Dbauthhandler "class=" Org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler "><property name=" SQL "value=" select password From user where username=? "/><property name=" DataSource "ref=" DataSource "/></bean>
Then find the Id=authenticationmanager bean, comment out Primaryauthenticationhandler, and add Dbauthhandler:
<!--<entry key-ref= "Primaryauthenticationhandler" value-ref= "Primaryprincipalresolver"/>--><entry key-ref= "Dbauthhandler" value-ref= "Primaryprincipalresolver"/>
Then reboot tomcat for verification, login Https://localhost:8443/cas/login for verification
cas-Simple authentication cas server login and read database account password login