时间:2021-07-01 10:21:17 帮助过:11人阅读
//
// phpCAS simple client
//
// import phpCAS lib
include_once('CAS.php');
//可以不用,用于调试,可以通过服务端的cas.log看到验证过程。
phpCAS::setDebug();
// initialize phpCAS
//phpCAS::client(CAS_VERSION_2_0,'服务地址',端口号,'cas的访问地址');
phpCAS::client(CAS_VERSION_2_0,'testsso.yigewang.com.cn',80,'');
// no SSL validation for the CAS server 不使用SSL服务校验
phpCAS::setNoCasServerValidation();
// force CAS authentication
//这里会检测服务器端的退出的通知,就能实现php和其他语言平台间同步登出了
phpCAS::handleLogoutRequests();
//phpCAS::checkAuthentication();
// 访问CAS的验证
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
$param=array("service"=>"http://localhost/phpCasClient/example_simple.php");//退出登录后返回
phpCAS::logout($param);
}
// for this test, simply print that the authentication was successfull
?>
phpCAS simple client
Successfull Authentication!这是客户端1
the user's login is .
用户名:===
===
=====
=====
=====
=====
phpCAS version is .
退出