uabookstores / laravel-shibboleth
为Laravel 5.x启用基本Shibboleth支持
Requires
- illuminate/support: 5.* || ^6.0 || ^7.0 || ^8.0 || ^9.0
- laravel/framework: ^5.4 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- mrclay/shibalike: 1.0.0
- php-open-source-saver/jwt-auth: ^1.4
Requires (Dev)
- orchestra/testbench: ^3.4|^4.0|^5.0
- phpunit/phpunit: ^6.0|^7.0|^8.0
- dev-master
- 3.4
- 3.3
- 3.2
- 3.1.1
- 3.1
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.1
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.0
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5
- 0.2
- 0.1
- dev-dev
- dev-revert-symfony-http-foundation
This package is auto-updated.
Last update: 2024-09-11 03:52:53 UTC
README
本软件包为Laravel提供Shibboleth身份验证。
在开发过程中,它可以模拟一个IdP(通过mrclay/shibalike)。
安装
使用composer将最新版本添加到您的项目中
composer require uabookstores/laravel-shibboleth
如果您正在运行Laravel >= 5.5,则可以跳过此步骤,否则您需要手动在您的config/app.php
文件中的Providers
数组中注册服务提供者。
StudentAffairsUwm\Shibboleth\ShibbolethServiceProvider::class,
如果您想通过shibalike使用模拟的IdP,则需要在任何版本上手动注册它 - 即使在Laravel 5.5中也不会自动加载。
StudentAffairsUwm\Shibboleth\ShibalikeServiceProvider::class,
注意 shibalike的密码与用户名相同。
发布默认配置文件
php artisan vendor:publish --provider="StudentAffairsUwm\Shibboleth\ShibbolethServiceProvider"
可选地,您还可以发布shibalike模拟的IdP登录视图
php artisan vendor:publish --provider="StudentAffairsUwm\Shibboleth\ShibalikeServiceProvider"
亚利桑那大学用户
要同时使用IdP注销,请在
config/shibboleth.php
中设置以下内容'idp_logout' => '/Shibboleth.sso/Logout?return=https%3A%2F%2Fshibboleth.arizona.edu%2Fcgi-bin%2Flogout.pl',
在您的config/auth.php
文件中将驱动程序更改为shibboleth
。
'providers' => [ 'users' => [ 'driver' => 'shibboleth', 'model' => App\User::class, ], ],
现在,用户可以通过访问https://example.com/shibboleth-login
通过Shibboleth登录,并使用https://example.com/shibboleth-logout
注销,这样您可以根据登录表单中的电子邮件地址提供自定义链接或重定向。
@if (Auth::guest()) <a href="/shibboleth-login">Login</a> @else <a href="/shibboleth-logout"> Logout {{ Auth::user()->name }} </a> @endif
您可以在config/shibboleth.php
中配置服务器变量映射,例如用户的首个名称、姓氏、权益等。您可以通过在认证后查看填充到$_SERVER
变量中的内容来查看它们。
<?php print_r($_SERVER);
映射值将在成功认证后将同步到用户表中。
授权
您可以静态地检查当前用户的权益字符串
$entitlement = 'urn:mace:uark.edu:ADGroups:Computing Services:Something'; if (Entitlement::has($entitlement)) { // authorize something }
现在,您可以为这些权益创建策略和网关。
本地用户
此软件包旨在与本地身份验证系统并行使用,适用于同时需要Shibboleth和本地用户的工程项目。如果您想允许本地注册以及验证Shibboleth用户,则可以使用Laravel的内置身份验证系统。
php artisan make:auth
JWTAuth令牌
如果您正在利用tymon/jwt-auth的令牌身份验证,请在您的.env
中设置此变量
JWTAUTH=true