xavrsl/cas
Composer 安装命令:
composer require xavrsl/cas
包简介
Add CAS server SSO authentication to Laravel 4 and 5
README 文档
README
CAS server SSO authentication in Laravel 4.x & 5.x
Installation
Require this package in your composer.json and run composer update.
For Laravel 4 use v1.1.* :
"xavrsl/cas": "1.1.*"
For Laravel 5 use v1.2.* :
"xavrsl/cas": "1.2.*"
After updating composer, add the ServiceProvider to the providers array:
For Laravel 4:
app/config/app.php
'Xavrsl\Cas\CasServiceProvider',
As well as the Facade :
'Cas' => 'Xavrsl\Cas\Facades\Cas',
For Laravel 5:
config/app.php
Xavrsl\Cas\CasServiceProvider::class,
As well as the Facade :
'Cas' => Xavrsl\Cas\Facades\Cas::class,
Then publish the package's config using one of those methods :
For Laravel 4 :
$ php artisan config:publish xavrsl/cas
For Laravel 5 :
$ php artisan vendor:publish
Configuration
Configuration should be pretty straightforward for anyone who's ever used the phpCAS client. Using the .env file will allow you to have different environments without even touching the cas.php config file. I've added the possibility to easily turn your application into a CAS Proxy, a CAS Service or both. You only need to set the cas_proxy setting to true (if you need to proxy services) and set the cas_service to whatever proxy you want to allow (this is all explained in the config file).
A new config variable (cas_pretend_user) available in the 1.2 release allows you to pretend to be a selected CAS user. The idea came with the usage of laravel homestead. My application was running on a private network, on a fake domain. The CAS server was not able to redirect to that application. So activating the CAS plugin on that application was not possible, but I needed a user id to query my LDAP and allow/disallow the user in my application. You only need to give it a user id and the application will act just as if you ware logged in with that CAS user.
Usage
Authenticate against the CAS server. This should be called before trying to retrieve the CAS user id.
Cas::authenticate();
Then get the current user id this way :
Cas::getCurrentUser();
OR
Cas::user();
xavrsl/cas 适用场景与选型建议
xavrsl/cas 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.16k 次下载、GitHub Stars 达 76, 最近一次更新时间为 2013 年 11 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「SSO」 「laravel」 「cas」 「phpCAS」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xavrsl/cas 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xavrsl/cas 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xavrsl/cas 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CAS bundle for PuMuKIT
Basic CAS (SSO) authenticator for Symfony 5.4, 6.0, 7.0 and 8.0
Symfony Lock Component
Provides a simple API for authenticating users against a CAS server
Simple Single Sign-On
Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client
统计信息
- 总下载量: 37.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 77
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-11-15