Download the PHP package chervand/yii2-oauth2-server without Composer
On this page you can find all versions of the php package chervand/yii2-oauth2-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chervand/yii2-oauth2-server
More information about chervand/yii2-oauth2-server
Files in chervand/yii2-oauth2-server
Package yii2-oauth2-server
Short Description OAuth 2.0 server for Yii 2.0 with MAC tokens support.
License MIT
Informations about the package yii2-oauth2-server
Yii 2.0 OAuth 2.0 Server
chervand/yii2-oauth2-server
is a Yii 2.0 PHP Framework
integration of thephpleague/oauth2-server
library which implements a standards compliant OAuth 2.0 Server
for PHP. It supports all of the grants defined in the specification with usage of JWT
Bearer
tokens.
chervand/yii2-oauth2-server
additionally provides MAC
tokens support, which is not supported by the original library, because MAC
tokens specification is currently in draft and it was not updated since 2014, so it's a pretty experimental feature.
It also includes tokens revocation implementation based on RFC7009.
Installation
Applying DB migrations
./yii migrate --migrationPath="@vendor/chervand/yii2-oauth2-server/migrations"
Generating public and private keys
See OAuth 2.0 Server installation page.
Integrating with your users
To integrate OAuth 2.0 server with your users DB, you should implement League\OAuth2\Server\Repositories\UserRepositoryInterface
for a user
component's identityClass
which should be extended from chervand\yii2\oauth2\server\models\AccessToken
. League\OAuth2\Server\Repositories\UserRepositoryInterface::getUserEntityByUserCredentials()
should return your user model instance implementing League\OAuth2\Server\Entities\UserEntityInterface
or null
. You may additionally add a foreign key for the auth__access_token.user_id
column referencing your users table. You mau also override getRateLimit()
to provider yii\filters\RateLimitInterface
with required values.
Configuring the authorization server
Module configuration:
Configuring the resource server
Controller's behaviors configuration:
RBAC
TBA
All versions of yii2-oauth2-server with dependencies
yiisoft/yii2 Version ^2.0
league/oauth2-server Version ^6.1
guzzlehttp/guzzle Version ^6.3
lcobucci/jwt Version 3.3.2