uicosss/shibboleth
Composer 安装命令:
composer require uicosss/shibboleth
包简介
README 文档
README
Shibboleth
PHP library for using Shibboleth for authentication and authorization.
Usage
To use the library, you need to:
Composer
composer require uicosss/shibboleth
require_once 'vendor/autoload.php';
Deploy asset files
This script will copy all the asset files to the full path provided. Can then modify these templates as desired. Along with copying the allowed.netids.example file where needed. File permissions may need to be adjusted to modify the deployed files.
php vendor/uicosss/shibboleth/scripts/deploy-assets.php /full/path/to/deploy/assets
ENV Config
These environment ($_ENV) variables must be set within the application using this package.
APP_DOCUMENT_ROOT - e.g. APP_DOCUMENT_ROOT=/var/www/app/assets - Primary absolute directory path, without trailing slash, to where to find an allowed.netids file. This must be set in the application's ENV variables.
APP_STATE - e.g. APP_STATE=LOCAL - [optional] Current application state: local/dev/qa/prod. This is used to force Shib to auth in local environments. This must be set in the application's ENV variables.
WEBMASTER_EMAIL - An email address that will be displayed on auth issue pages.
WEBMASTER_URL - Website that users will be linked to on auth issue pages.
WEBMASTER_OFFICE_TITLE - Name of department or group that users will see on auth issue pages.
Instantiate an object
With or without $authorizationContext as a parameter. $authorizationContext is an optional parameter that defines a secondary absolute directory path, without trailing slash, to where to find an allowed.netids file. This can be useful when different authorization is needed from the global APP_DOCUMENT_ROOT authorization file, for a specific part of the application.
$Shibboleth = new Uicosss\Shibboleth\Shibboleth();
// or with $authorizationContext
$Shibboleth = new Uicosss\Shibboleth\Shibboleth('/var/www/app/alt/assets');
Checking if authenticated
This is the first check when using this library. It confirms that there is a user logged in via Shibboleth.
if (!$Shibboleth->isAuthenticated()) {
$Shibboleth->authenticationMarkup();
die;
}
Checking if authorized
This is the second check when using this library. It checks any allowed.netids file it can find to verify permissions for the user.
if (!$Shibboleth->isAuthorized()) {
$Shibboleth->forbiddenMarkup();
die;
}
Rendering auth issues shortcut
A built-in method can automatically handle authentication and authorization issues and render HTML markup. Pass an absolute path to the directory containing the HTML files either copied from the package or custom-made. The filenames should still match what is expected authentication.html and forbidden.html.
$Shibboleth->renderAuthIssues('/var/www/app/assets');
Testing
You can run the unit tests by executing this command from the project root.
./vendor/bin/phpunit --colors --verbose
To only execute one of the tests add this to the command
./vendor/bin/phpunit --colors --verbose --filter testMethodName
uicosss/shibboleth 适用场景与选型建议
uicosss/shibboleth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 79 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 uicosss/shibboleth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 uicosss/shibboleth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 79
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-13