cas 搭建准备工作:
cas-server-3.4.4
cas-client-3.2.0
apache-tomcat-6.0.14
去掉https认证,改成http认证
1、进入WEB-INF\spring-configuration目录
打开warnCookieGenerator.xml文件
修改p:cookieSecure的值为false
2、打开ticketGrantingTicketCookieGenerator.xml文件
同样修改p:cookieSecure的值为false
3、打开WEB-INF\deployerConfigContext.xml文件
查找org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler
把这代码块修改为如下:(添加 p:requireSecure="false" )
Xml代码
p:httpClient-ref="httpClient" p:requireSecure="false" />
java 客户端配置
Xml代码
org.jasig.cas.client.session.SingleSignOutHttpSessionListener
CAS Single Sign Out Filter
org.jasig.cas.client.session.SingleSignOutFilter
CAS Single Sign Out Filter
/*
CASFilter
org.jasig.cas.client.authentication.AuthenticationFilter
casServerLoginUrl
http://116.226.60.173:8888/cas/login
serverName
http://116.226.60.173:8888
CASFilter
/front/member/*
CASFilter
/memberCenter/*
CAS Validation Filter
org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
casServerUrlPrefix
http://116.226.60.173:8888/cas
serverName
http://116.226.60.173:8888
CAS Validation Filter
/*
CAS HttpServletRequest Wrapper Filter
org.jasig.cas.client.util.HttpServletRequestWrapperFilter
CAS HttpServletRequest Wrapper Filter
/*
CAS Assertion Thread Local Filter
org.jasig.cas.client.util.AssertionThreadLocalFilter
CAS Assertion Thread Local Filter
/*
php 端配置
Java代码 require_once 'CAS.php';
define('CAS_SERVER_HOSTNAME', "192.168.18.8");
define('CAS_SERVER_PORT', 8888);
define('CAS_SERVER_APP_NAME', "cas");
phpCAS::setDebug();
phpCAS::client(CAS_VERSION_2_0, CAS_SERVER_HOSTNAME, CAS_SERVER_PORT, CAS_SERVER_APP_NAME);
phpCAS::setNoCasServerValidation();
phpCAS::handleLogoutRequests();
phpCAS::forceAuthentication();
$username = phpCAS::getUser(); //获取cas 服务端用户名