jonnx/laravel-spark-sso
Composer 安装命令:
composer require jonnx/laravel-spark-sso
包简介
a simple SSO solution leveraging existing OAuth2 services
README 文档
README
This package manges the OAuth handshake with Google so people can join you Laravel Spark based project even faster. Teams can configure their SSO domain so if they use GMail for their business, every new signup from that company will be added to the team automatically. This is a great way to reduce onboarding hurdles and eliminates the need for people to remember another password.
Once installed and configured, users will be able to join and login by going to the following url:
https://www.your-awesome-project.com/login/sso/google
Getting Started
Install the package
This will install the package and its dependencies which includes the laravel/socialite
library to hanle the OAuth handshake with a number of providers.
composer require jonnx/laravel-spark-sso
Register Package ServiceProviders
To achieve this, update your config/app.php file by adding the following lines
'providers' => [
...
/**
* Package Service Providers...
*/
Jonnx\LaravelSparkSSO\LaravelSparkSSOServiceProvider::class,
Laravel\Socialite\SocialiteServiceProvider::class,
...
]
also add the following aliases
'aliases' => [
...
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
'User' => Namespace\For\Models\User::class,
'Team' => Namespace\For\Models\Team::class,
]
Update configuration
In order for Google to perform the handshake, you need a client and secret
from their developer console. Once you have those keys, add the following lines
to the config/services.php file:
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('APP_URL') . '/login/sso/google/callback',
],
Add SSO Settings Link for Your Team Owners
Your team owners will be able to edit their SSO setting independently at
https://www.your-domain.com/settings/teams/{id}/sso for them to get to
that url you should add the link to your project where they can find it.
I recommend adding a link to the existing membership page in the Laravel Spark
settings or adding it to the existing drop down menu in the user.blade.php
In a future release I would like to be able to automatically inject this link but for now it is up to the developer to do so.
Customizing the SSO Settings Screen
There is a view file that the owners of your teams can use to confiure their SSO email domain.
If you want to change this template, simply publish the vendor files and edit the file in views/vendor/laravel-spark-sso.
php artisan vendor:publish
jonnx/laravel-spark-sso 适用场景与选型建议
jonnx/laravel-spark-sso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 130 次下载、GitHub Stars 达 6, 最近一次更新时间为 2018 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jonnx/laravel-spark-sso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jonnx/laravel-spark-sso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 130
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-03