api-skeletons / oauth2-doctrine-identity
Doctrine Enabled AuthenticatedIdentity
Installs: 8 464
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 3
Open Issues: 2
Requires
- php: ^7.3
- api-skeletons/oauth2-doctrine: ^5.0
- bshaffer/oauth2-server-php: ^1.10
- container-interop/container-interop: ^1.1
- gianarb/angry: ^1.0
- laminas/laminas-dependency-plugin: ^2.0
Requires (Dev)
- api-skeletons/coding-standard: ^1.0
- laminas-api-tools/api-tools: ^1.4.1
- laminas-api-tools/api-tools-doctrine: ^2.3.0
- laminas/laminas-hydrator: ^2.2
- laminas/laminas-i18n: ^2.7
- laminas/laminas-test: ^3.0
- phpro/zf-doctrine-hydration-module: ^2.0.1 || ^3.0 || ^4.1
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-11-29 06:22:04 UTC
README
Versions
1.x for PHP 5.5 to 7.0. 2.x for PHP 7.1 onward.
About
By default laminas-api-tools/api-tools-mvc-auth returns an Laminas\ApiTools\MvcAuth\Identity\AuthenticatedIdentity
when authenticated with a valid access token. This repository replaces that identity with a ApiSkeletons\OAuth2\Doctrine\Identity\AuthenticatedIdentity
.
ApiSkeletons\OAuth2\Doctrine\Identity\AuthenticatedIdentity
stores the api-skeletons/oauth2-doctrine AccessToken
Doctrine entity. The AuthentiatedIdentity
has the functions getUser()
, getAccessToken()
, getClient()
which return entities. With these your application can continue to work with ORM through the rest of the request lifecycle.
api-skeletons/oauth2-doctrine supports multiple OAuth2 configurations and api-skeletons/oauth2-doctrine-identity searches through each configuration to find the AccessToken
entity based on the access_token
and client_id
supplied by Laminas\ApiTools\MvcAuth\Identity\AuthenticatedIdentity
.
Authorization
The api-tools-mvc-auth Authorization Service is injected into the AuthenticatedIdentity
. You may fetch the Authorization Service with $identity->getAuthorizationService()
. There is a convenience method for ACL $identity->isAuthorized($resource, $privilege)
.
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
composer require api-skeletons/oauth2-doctrine-identity
This will be added to your application's list of modules:
'modules' => array( ... 'ApiSkeletons\OAuth2\Doctrine\Identity', ),