cuifox/yii2-oauth2-server
最新稳定版本:1.0.0
Composer 安装命令:
composer require cuifox/yii2-oauth2-server
包简介
yii2-oauth2-server
README 文档
README
A wrapper for implementing an OAuth2 Server(https://gitee.com/cuifox/yii2-oauth2-server.git)
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist cuifox/yii2-oauth2-server "*"
or add
"cuifox/yii2-oauth2-server": "^1.0"
to the require section of your composer.json.
To use this extension, simply add the following code in your application configuration:
'modules' => [
'oauth2' => [
//'class' => 'filsh\yii2\oauth2server\Module',
'class' => 'CuiFox\oauth2server\Module',
'tokenParamName' => 'access_token', // 访问令牌参数名称(可选)
'tokenAccessLifetime' => 3600, // 访问令牌有效期(可选)
'storageMap' => [
'user_credentials' => 'app\models\User', // 用于验证用户凭据的存储器(根据你的应用需求替换)
'user_claims' => 'app\models\User', // 用于验证用户凭据的存储器(根据你的应用需求替换)
],
'grantTypes' => [
'authorization_code' => [
'class' => 'OAuth2\GrantType\AuthorizationCode',
],
'user_credentials' => [
'class' => 'OAuth2\GrantType\UserCredentials',
],
'client_credentials' => [
'class' => 'OAuth2\GrantType\ClientCredentials',
],
'refresh_token' => [
'class' => 'OAuth2\GrantType\RefreshToken',
'config' => [
'always_issue_new_refresh_token' => true,
],
],
'jwt_bearer' => [
'class' => 'OAuth2\GrantType\JwtBearer',
'audience' => 'http://yii-abc.com',
],
// 此处需要options中的OpenID Connect
/*'authorization_code' => [
'class' => 'OAuth2\OpenID\GrantType\AuthorizationCode',
],*/
],
'options' => [
'allow_implicit' => true,
// configure the server for OpenID Connect
/*'use_openid_connect' => true,
'issuer' => 'yii-abc.com',*/
],
//'useJwtToken' => true,
],
],
You can pass additional OAuth2 Server Options by setting `options` property on the module. Some of them are implemented as standalone properties on the module: `tokenParamName`, `tokenAccessLifetime`, `useJwtToken`. For a full list of the supported options go to the - [source code](https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L162).
this migration creates the oauth2 database scheme and insert test user credentials ```testclient:testpass``` for ```http://fake/```
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-30