mfc/oauth2
Composer 安装命令:
composer require mfc/oauth2
包简介
Generic OAuth2 authentication and authorization for TYPO3 CMS
关键字:
README 文档
README
This extension provides OAuth 2.0 authentication for TYPO3 installations.
1. Features
- Can automatically create new backend users
- Certain OAuth resource servers can control admin permissions and assign backend group memberships
2. Usage
1) Installation
The only way to install this extension is by using Composer. In your Composer based TYPO3 project root, just run composer require mfc/oauth2.
2) Configure the extension
To add an OAuth2 Server for login, we recommend you create your own little extension, use your existing site
package or put the configuration in your config/system/additional.php.
2.1) Using the GitLab Provider included in this extension
Configuring the GitLab Login Provider is pretty straight forward. Just put the following configuration into your ext_localconf.php
or the aforementioned config/system/additional.php and customize it to your needs.
Mfc\OAuth2\ResourceServer\Registry::addServer( 'gitlab', // identifier for the Resource Server 'Login with GitLab', // Text displayed on the Login Screen \Mfc\OAuth2\ResourceServer\GitLab::class, [ 'enabled' => true, // Enable/Disable the provider 'arguments' => [ 'appId' => 'your-app-id', 'appSecret' => 'your-app-secret', 'gitlabServer' => 'https://gitlab.com', // Your GitLab Server 'gitlabAdminUserLevel' => \Mfc\OAuth2\ResourceServer\GitLab::USER_LEVEL_DEVELOPER, // User level at which the user will be given admin permissions 'gitlabDefaultGroups' => '0', // Groups to assign to the User (comma separated list possible) 'gitlabUserOption' => 0, // UserConfig 'blockExternalUser' => false, // Blocks users with flag external from access the backend 'projectName' => 'your/repo', // the repository from which user information is fetched ], ] );
You can obtain the required information for the provider by going to either https://gitlab.com/profile/applications if you're using the hosted version of GitLab, or to the equivalent page on your self-hosted GitLab server.
When creating the application within GitLab, you might need the following information:
- Redirect URI:
<your-domain-here>/typo3/index.php - Scopes:
read_api,read_user,openid
2.2) Creating your own provider
To create your own Provider, you need to create your own extension, and create a class which extends
Mfc\OAuth2\ResourceServer\AbstractResourceServer. You can then use the same boilerplate shown in 2.1 to register
your newly created provider. The arguments array included in the provider registration will be provided as-is as
the first argument to your providers constructor, with the addition of a providerName key which contains the identifier
you set in your registration.
Example
You've created your own extension, and created the class Just\AnExample\Providers\ExampleProvider.
To register your provider you'd extend the configuration as follows
Mfc\OAuth2\ResourceServer\Registry::addServer( 'example-provider', // identifier for the Resource Server 'Login with Example', // Text displayed on the Login Screen \Just\AnExample\Providers\ExampleProvider::class, [ 'enabled' => true, // Enable/Disable the provider 'arguments' => [ 'yourarg' => 'somevalue', // ... ], ] );
The first argument passed to your provider will be:
array( 'providerName' => 'example-provider', 'yourarg' => 'somevalue', // ... );
2.3) Change the default Cookie Settings in TYPO3
To use the redirect mechanism of oAuth you must allow lax cookie settings for TYPO3: cookieSameSite must be set to 'lax'.
$GLOBALS['TYPO3_CONF_VARS']['BE']['cookieSameSite'] = 'lax'
3. License
mfc/oauth2 is released under the terms of the GPL-2 License.
4. Support
Free Support is available via Github Issue Tracker For commercial support, please contact us at info@marketing-factory.de
mfc/oauth2 适用场景与选型建议
mfc/oauth2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 308.92k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2018 年 06 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「oauth」 「TYPO3 CMS」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mfc/oauth2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mfc/oauth2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mfc/oauth2 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
GraphQL authentication for your headless Craft CMS applications.
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Library for ORCID web services
Set Links with a specific language parameter
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.
统计信息
- 总下载量: 308.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 27
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2018-06-22