notakey/simplesamlphp-module-oauth2
Composer 安装命令:
composer require notakey/simplesamlphp-module-oauth2
包简介
A SimpleSAMLphp module adding support for the OAuth 2.0 protocol.
关键字:
README 文档
README
Installation
This package add support for the OAuth2 protocol through a SimpleSAMLphp module installable through Composer. Installation can be as easy as executing:
composer.phar require sgomez/simplesamlphp-module-oauth2 1.0.0 # for SSP < 1.14
composer.phar require sgomez/simplesamlphp-module-oauth2 ~1.0 # for SSP >= 1.14
composer.phar require sgomez/simplesamlphp-module-oauth2 ~2.0 # for SSP >= 2.0|master
Configuration
Configure the module
Copy the template file to the config directory:
cp modules/oauth2/config-template/module_oauth2.php config/
and edit it. The options are self explained.
Create oauth2 clients
To add and remove Oauth2 clients, you need to logon on simplesaml with an admin account. Open the Federation tab and you will see the OAuth2 Client Registry option.
You can specify as many redirect address as you want.
Using the module
This module is based on Oauth2 Server from the PHP League and supports implicit and explicit tokens.
Create the oauth2 keys:
The oauth2 library used generates Json Web Tokens to create the Access Tokens, so you need to create a public and private cert keys:
To generate the private key run this command on the terminal:
openssl genrsa -out cert/oauth2_module.pem 1024
If you want to provide a passphrase for your private key run this command instead:
openssl genrsa -passout pass:_passphrase_ -out cert/oauth2_module.pem 1024
then extract the public key from the private key:
openssl rsa -in cert/oauth2_module.pem -pubout -out cert/oauth2_module.crt
or use your passphrase if provided on private key generation:
openssl rsa -in cert/oauth2_module.pem -passin pass:_passphrase_ -pubout -out cert/oauth2_module.crt
If you use a passphrase remember to configure it in the module_oauth2.php config file.
Explicit Token
To ask an explicit token see the Authorization Code Grant help page to know the parameters than you need to send (see Part One).
The address to the authorization server is: {{baseurlpath}}/module.php/oauth2/authorize.php
Now you need to ask for an access token. See the Part Two.
The address to the access token server is: {{baseurlpath}}/module.php/oauth2/access_token.php
Implicit Token
To ask an implicit token see the Implicit Grant help page to know the parameters than you need to send.
The address to the authorization server is: {{baseurlpath}}/module.php/oauth2/authorize.php
Take the attributes
To recover the user attributes you need to send and Authorization header with the Access Token as
a Bearer Token to the userinfo page: {{baseurlpath}}/module.php/oauth2/userinfo.php
Example:
curl --request GET \
--url http://server.com/simplesaml/module.php/oauth2/userinfo.php \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni...'
notakey/simplesamlphp-module-oauth2 适用场景与选型建议
notakey/simplesamlphp-module-oauth2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「oauth2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 notakey/simplesamlphp-module-oauth2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 notakey/simplesamlphp-module-oauth2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 notakey/simplesamlphp-module-oauth2 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
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.
Email Toolkit Plugin for CakePHP
The missing social authentication for thephpleague/oauth2-server, adapted from schedula/league-oauth2-social
Oauth 2 client for Ubiquity framework
Authorization Server library for OAuth 2.0 Authorization Framework
Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client
统计信息
- 总下载量: 152
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-17