gcs/oidc-client
Composer 安装命令:
composer require gcs/oidc-client
包简介
README 文档
README
A Laravel package for delegating authentication to an OpenID Provider.
How to install
Begin by adding this package to your depedencies with the command:
composer require gcs/oidc-client
Then add the following line to the list of registered service providers in config/app.php:
GCS\OIDCClient\OIDCServiceProvider::class
Edit your config/auth.php file to use OpenID as the authentication method for your users:
'guards' => [
'web' => [
'driver' => 'oidc',
...
],
...
],
How to configure
Run the following command to publish the config/oidc.php configuration file:
php artisan vendor:publish --provider="GCS\OIDCClient\OIDCServiceProvider"
The settings to configure are the following
client_idThis is the ID of your client application used by the OpenID provider. You should set this through an environment variable calledOIDC_CLIENT_ID.client_secretThis is the secret code of your client application only known by the OpenID provider. You should set this through an environment variable calledOIDC_CLIENT_SECRET.provider_urlThis is base URL of the OpenID provider. You should set this through an environment variable calledOIDC_PROVIDER_URL.provider_nameThis is a short name for your OpenID provider, which will only appears in your OpenID routes. Do not use spaces. You should set this through an environment variable calledOIDC_PROVIDER_NAME.scopesThis is a list of scopes your application will request from the OpenID provider. Theopenidscope is required. Add any additional scopes.
How to use
Once everything is set up, you can replace your login system with a call to the route route('oidc.signin'). For logouts, use the route route('oidc.signout').
You may want to overwrite the $redirectTo variable inside OIDCController in order to specify the route you want your users to be taken to upon successful authentication.
Another important method you may need to overwrite is retrieveByInfo inside OIDCUserProvider. This function takes the array of user attributes retrieved from the OpenID provider, and returns a User model for the authenticated user. This is where you may want to merge the info you receive from the provider with the info you hold about that user in your application database.
Developed by Cabinet Office Digital Development in October 2019.
gcs/oidc-client 适用场景与选型建议
gcs/oidc-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 404 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gcs/oidc-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gcs/oidc-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 404
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-14