1.生成证书
1.1cmd输入:
keytool -genkey -alias tomcat -keyalg RSA
1.2生成keystore
这里的名字与姓氏写成最好写成域名,或者你能记住的,到时候java配置cas地址要一致否则会有问题。其他随便写
完毕后会有一个.keystore文件,我们把这个文件拷贝到tomcat\bin目录下面。
1.3获取证书文件
1.3.1进入tomcat\bin目录下面
keytool -selfcert -alias tomcat -keystore .keystore
keytool -export -alias tomcat -keystore .keystore -storepass 123456 -rfc -file tomcat.cer
注意:123456这个我之前的密令
2.tomcat配置https
在tomcat\conf\server.xml
<Connector port=“8443” protocol=“org.apache.coyote.http11.Http11Protocol”
maxThreads=“150” SSLEnabled=“true” scheme=“https” secure=“true” clientAuth=“false” sslProtocol=“TLS” maxHttpHeaderSize=“4096”
keystoreFile=“bin/.keystore” keystorePass=“123456”
trustoreFile=“bin/.keystore” truststorePass=“123456”/>
3.cas配置https(这里不配好像也可以用)
在application.properties
server.ssl.keyStore=/etc/cas/casServer.keystore
server.ssl.keyStorePassword=test123
server.ssl.keyPassword=test123
server.ssl.enabled=true
server.ssl.key-alias=cas.server.com
4.配置cas登出允许重定向
编写application.properties
cas.logout.followServiceRedirects=true
5.java导入证书
5.1生成cacerts
keytool -import -alias tomcat -keystore cacerts -file tomcat.cer
完成之后tomcat\bin目录下面会有一个cacerts