accentinteractive/laravel-sso
Composer 安装命令:
composer require accentinteractive/laravel-sso
包简介
Azure AD SSO (Single Sign On) login management for Laravel.
README 文档
README
Installation
You can install the package via composer:
Step 1
composer require accentinteractive/laravel-sso
Step 2
Register your application with the Azure portal. You need a valid Microsoft account and the proper authorization for your company. For a full manual, see Registering a new Azure AD application.
Step 3
Once your have registered the application with Azure AD, add the proper credentials to your .env file. Get the proper IDs and secrets from https://portal.azure.com/
SSO_ENABLED=true # App Registrations › Application › Application (client) ID SSO_CLIENT_ID="YOUR_CLIENT_ID_HERE" # App Registrations › Application › Directory (tenant) ID SSO_TENANT_ID="YOUR_TENANT_ID_HERE" # App Registrations › Application › Client credentials › New client secret SSO_CLIENT_SECRET="YOUR_CLIENT_SECRET_HERE" # App Registrations › Application › Redirect URIs (platform 'Web') SSO_CLIENT_REDIRECT_URL="https://YOURDOMAIN.COM/login" SSO_AUTH_TENANT=common
Step 4
Add the middleware to your 'web' middleware group to place all endpoints behind SSO, or to another group if you want to guard only several of your endpoints..
\Accentinteractive\LaravelSso\Http\Middleware\AuthenticateSSO::class,
For Laravel >10, place it in bootstrap/app.php.
// [...] ->withMiddleware(function (Middleware $middleware) { // Register multitenancy middleware $middleware->appendToGroup('web', [ \Accentinteractive\LaravelSso\Http\Middleware\AuthenticateSSO::class, ]);
For Laravel <=10, place it in app/Http/Kernel.php.
'web' => [ // [...] \Accentinteractive\LaravelSso\Http\Middleware\AuthenticateSSO::class, ],
Step 5
Optionally you can publish the config file with:
php artisan vendor:publish --provider="Accentinteractive\LaravelSso\LaravelSsoServiceProvider" --tag="config"
Register a new Azure AD application
For Azure AD Single Sign On to work properly, you must supply the following Azure AD credentials in your .env file:
Application (client) IDDirectory (tenant) IDClient SecretRedirect URI
Important: your Client Secret has an expiration date. Before the secret expires, make sure to create another new secret and supply it in in .env, so you employees can continue to log using SSO. A good expiration time would be 12 or 24 months.
- To create the Azure AD Plan Ahead application. IDs and secrets, do the following;
- Go to Azure AD while logged in as Microsoft User for your organization: https://portal.azure.com/.
- Go to App Registrations (https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade).
- Click 'New Registration' to add your application.
- Enter a name.
- Select 'Accounts in this organizational directory only'.
- Click 'Register'.
- Make note of the
Application (client) ID - Make note of the
Directory (tenant) ID - Click 'Redirect URIs'.
- Under 'Web', click 'Add URI'.
- Enter the correct redirect URI (https://YOURDOMAIN.COM/login) and hit [ENTER]
- Make note of the redirect URL.
- Go back to the app Registration and click 'Client Credentials'.
- Click 'New Client Secret'.
- Enter a name for the secret.
- Choose an expiry period (maximum 24 months).
- Click 'Add'.
- Make note of the 'Value' for your Client secret. Important: You can only view a secret once, directly after creation.
- Go back to the app Registration and go to Manage › Manifest.
- In the XML, edit "allowPublicClient" to say false.
- In the XML, edit "oauth2AllowIdTokenImplicitFlow" to say true.
- Click Save.
- Before the secret expires, make sure to create another new secret and enter it to to your .env file in time, so you can continue to log with SSO.
Config settings
You can pass config settings to modify the behaviour.
You can also pass options directly.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email joost@accentinteractive.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
accentinteractive/laravel-sso 适用场景与选型建议
accentinteractive/laravel-sso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「accentinteractive」 「laravel-sso」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 accentinteractive/laravel-sso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 accentinteractive/laravel-sso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 accentinteractive/laravel-sso 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Keep your laravel logs small and tidy.
Block bad bots and users that visit certain (exploit) urls for a set amount of time.
Keep your laravel logs small and tidy.
Test a string against a disallowlist. Useful for user forms and such.
Do not process URLs with a extensions like .jpg, .png et cetera.
Validate data against one or multiple disallowlists, using the built-in Laravel validator or by calling the facade directly. Supports wildcards.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-07