配置CAS客户端(php 客户端 )
来源:互联网 发布:福昕阅读器mac中文版 编辑:程序博客网 时间:2024/06/07 18:46
Php客户端配置相当简单,你只需把php客户端包解压至服务器根目录下, cas 的php 客户端就配置好了。
phpCAS requirements
Webserver
Any webserver like Apache, IIS and others should work.
CURL (7.5+)
CURL libs must be present on your system, and they must have been compiled with SSL support.
PHP >= 5.0 (PHP >= 4.2.2 for 1.1.x)
phpCAS users must have PHP compiled with the following options:
- --with-curl: CURL support, needed to access proxies.
- --with-openssl: SSL support, needed for fopen('https://...'), to validate CAS tickets;
- --with-dom: DOM support, to read the XML responses of the CAS server (PHP4);
- --with-zlib: Zlib support, needed by DOM.
我们来测试一下这个php的cas 客户端是否起作用。
修改php客户端自带的一个示例:example_simple.php,并拷贝到根目录目录中。
(实例文件路径在/cas/docs/example/下,你也可以多试几个)
代码修改如下:
<?php
// phpCAS simple client
// import phpCAS lib
include_once(‘CAS.php’);
phpCAS::setDebug();
// initialize phpCAS
phpCAS::client(CAS_VERSION_2_0,’localhost’,8443,’cas’);
// 参数说明
//CAS_VERSION_2_0版本,一般不用变
// ‘localhost’ 可以改成你的服务器端域名,注意是cas服务器端
// 8443 服务器端 端口号
//cas 就是文件夹名,同样是服务器端那个,自行修改
// no SSL validation for the CAS server
phpCAS::setNoCasServerValidation();
// force CAS authentication
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'])) {
phpCAS::logout();
}
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<p>the user’s login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href=”?logout=”>Logout</a></p>
</body>
</html>
红色为修改添加部分。
测试:
1) 访问http://localhost/ example_simple.php
2) Cas检测到用户没有登录,转向:
https://localhost:8443/cas/login?service=http%3A%2F%2Flocalhost%2Fexample_simple.php 登录界面。
3) 在登录界面输入admin/admin 用户名和密码。(之前没有注释掉)
4) 登录成功,转回http://localhost/ example_simple.php,并显示有关信息。
- 配置CAS客户端(php 客户端 )
- CAS服务端,JAVA客户端,PHP客户端配置
- linux下配置CAS 的PHP客户端
- CAS 客户端配置
- Cas 客户端配置
- play cas 客户端配置
- cas 客户端配置说明
- cas 客户端配置
- CAS 客户端配置
- 配置简单cas客户端
- jasig CAS客户端配置
- 配置CAS应用客户端
- play 2.10配置cas客户端
- CAS客户端配置及定制
- spring mvc配置cas客户端
- sso cas+security客户端配置
- CAS客户端基本配置备忘
- Cas单点登录客户端配置
- Oracle存储过程(10 级学员 庞丽课堂总结)
- linux 0号进程 1号进程 区别
- CS0016: 未能写入输出文件“c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb
- Textview的参数
- 脚本录制和回放终端会话(script、scriptreplay)使用
- 配置CAS客户端(php 客户端 )
- 我的SqlHelper类【雏形】
- 44.腾讯面试题
- QT:用QSet储存自定义结构体的问题
- 串行等价化 事务 并发 加锁 死锁
- 第五周任务四
- 测试
- VS2010不能访问ORACLE中用PL/SQL建的数据表
- openSession和getCurrentSession的区别 thred jta