cas sso 集成 java + php (discuz,bbs) 配置
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"? )
?
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 服务端用户名?