iansimpson/ss-oauth2-server
Composer 安装命令:
composer require iansimpson/ss-oauth2-server
包简介
Silverstripe OAuth 2.0 Server
README 文档
README
Introduction 👋
This allows your Silverstripe site to be in OAuth 2.0 provider.
Please note that this is under development. It should work just fine, but has not been extensively tested, and is poorly documented.
It supports the following grants:
- Authorization code grant
- Refresh grant
⚠️ Upgrade Warning
Grant Type Validation
Grant type validation has been updated to strictly match the grant type stored in the Silverstripe CMS against the grant type sent in the request. Previously, these could differ without causing an error.
Action required: If you are upgrading from previous module version or upgrading to CMS version 6, you must ensure that the Grant Type value stored against each OAuth client in the CMS matches the grant type used in your access token requests (e.g. authorization_code, client_credentials). Mismatched values will now cause the token request to be rejected.
Requirements 🦺
- PHP ^8.1
- Silverstripe ^4.13
Installation 👷♀️
Install the add-on with Composer:
composer require iansimpson/ss-oauth2-server
Next, generate a private/public key pair:
openssl genrsa -out private.key 2048 openssl rsa -in private.key -pubout -out public.key chmod 600 private.key chmod 600 public.key
Put these on your web server, somewhere outside the web root
Generate encryption key:
php -r 'echo base64_encode(random_bytes(36)), PHP_EOL;'
Add the following lines in your .env, updating the OAUTH_PRIVATE_KEY_PATH and OAUTH_PUBLIC_KEY_PATH to point to the key files, and adding the encryption key you have just generated:
OAUTH_PRIVATE_KEY_PATH="/path/to/my/private.key" OAUTH_PUBLIC_KEY_PATH="/path/to/my/public.key" OAUTH_ENCRYPTION_KEY="my-encryption-key"
Finally, after doing a /dev/build/ go into your site settings and on the OAuth Configuration and add a new Client. Using this you should now be able to generate a key at /oauth/authorize, per the OAuth 2.0 spec (https://tools.ietf.org/html/rfc6749).
Usage 🏃🏃🏃
To verify the Authorization header being submitted is correct, add this to your Controller:
$member = IanSimpson\OAuth2\OauthServerController::getMember($this);
it will return a Member object if the Authorization header is correct, or null if there's an error. Simple!
iansimpson/ss-oauth2-server 适用场景与选型建议
iansimpson/ss-oauth2-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.57k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「oauth」 「oauth2」 「oauth 2.0」 「silverstripe」 「oauth 2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 iansimpson/ss-oauth2-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 iansimpson/ss-oauth2-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 iansimpson/ss-oauth2-server 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Library for ORCID web services
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Light SAML 2.0 PHP library
Email Toolkit Plugin for CakePHP
统计信息
- 总下载量: 7.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-25