cas php client配置,php使用phpCAS接入CAS SSO

源码:外链网址已屏蔽

文档:外链网址已屏蔽

安 装

ubuntu下使用pear安装

sudo pear install  外链网址已屏蔽

配置

//  CAS Server 主机

$cas_host = 'cas-server';

// CAS Server 路径

$cas_context = '/cas';

// CAS server.端口

$cas_port = 443;

// CAS Server 证书

$cas_server_ca_cert_path = './ssoserver.cer';

使用

//验证访问用户是否合法

require_once 'include/cas_config.php';

require_once  'phpcas/CAS.php';

// Enable debugging

phpCAS::setDebug();

// Initialize phpCAS

phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);

// For production use set the CA certificate that is the issuer of the cert

// on the CAS server and uncomment the line below

// phpCAS::setCasServerCACert($cas_server_ca_cert_path);

// For quick testing you can disable SSL validation of the CAS server.

// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.

// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!

phpCAS::setNoCasServerValidation();

// force CAS authentication

phpCAS::forceAuthentication();

// 取得登陆用户id

$cas_user_id = phpCAS::getAttribute('id');

//phpCAS::logout();

原 理

推荐资料:外链网址已屏蔽

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值