conf09 / saml2-bearer
此包的最新版本(1.1.7)没有可用的许可信息。
此包为CAS Apereo的saml2身份验证与oauth2.0的授权
1.1.7
2022-02-18 05:51 UTC
Requires
- php: >=5.5.0
- ext-openssl: *
- illuminate/support: >=5.0.0
- onelogin/php-saml: ^3.0.0
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.0
README
此包是基于Laravel CAS配置的Saml2,用于单点登录目的
安装 - Composer
您可以通过composer安装此包
composer require conf09/saml2-bearer
或者手动将其添加到您的composer.json文件中
composer.json
"conf09/saml2-bearer": "*"
如果您使用的是Laravel 5.5及更高版本,服务提供程序将自动注册。
对于Laravel 5.5以下的旧版本,您需要添加服务提供程序
config/app.php
'providers' => [ ... Saml\Bearer\Saml2BearerServiceProvider::class, ]
使用发布命令将包配置复制到本地配置
php artisan vendor:publish --provider="Saml\Bearer\Saml2BearerServiceProvider"
配置.env文件
SAML2_CAS_IDP_HOST= // contain about cas url “https://<host>/cas”
SAML2_CAS_IDP_x509= // contain of public x509 # contact developer of cas for this information
配置身份验证中间件
//this enable authentication if not authenticate in application $saml2Bearer = Saml2Bearer::make(); return $saml2Bearer->getSamlAuth()->login(URL::full());
我们需要配置事件,当CAS服务器返回用于身份验证令牌和数据时
在EventServiceProvider.php的boot()函数中配置事件
Event::listen(Saml2LoginEvent::class, function (Saml2LoginEvent $event) { // your logic application here });
完成