定制 exeba/simplesamlphp-module-oauth2 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

exeba/simplesamlphp-module-oauth2

最新稳定版本:4.0.2

Composer 安装命令:

composer require exeba/simplesamlphp-module-oauth2

包简介

A SimpleSAMLphp module adding support for the OAuth2 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 exeba/simplesamlphp-module-oauth2 ~3.0

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 or the schema

The schema is maintaned using doctrine command line tool located at

path/to/simplesaml/modules/oauth2/bin/doctrine

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 the following grants:

  • Authorization code grant
  • Client credentials grant
  • Refresh grant

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.

Endpoints

  • Authorization Endpoint: {{baseurlpath}}/module.php/oauth2/authorize
  • Token Endpoint: {{baseurlpath}}/module.php/oauth2/access_token
  • Token Introspection Endpoint: {{baseurlpath}}/module.php/oauth2/userinfo

统计信息

  • 总下载量: 581
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-29