Download the PHP package bandronic/oauth2server without Composer
On this page you can find all versions of the php package bandronic/oauth2server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oauth2server
OAuth2Server
Implementation of the OAuth2 server using Doctrine ORM.
The package forks BShaffer's OAuth2 implementation and adapts it to use Doctrine, PSR4 and PSR7.
Requirements
bshaffer/oauth2-server-php
dasprid/container-interop-doctrine
Installation
-
Add the ConfigProvider to the config/container.php file:
-
In the config/autoload/local.php add an array for oauth2:
Alternatively you can copy the data\oauth2.local.php.dist file in the config/autoload folder and change the values inside it accordingly.
You must specify an entity for the user_entity config entry. The user_entity class must implement the interface:
Optional, if you wish to change the get client details, scope or grant type check, you can specify a client service in the client_service settings parameter. The client service must implement the interface
-
Create a folder keys in the config folder and inside it generate the private and public keys:
- Create a private key openssl genrsa -out private.key 1024
- Create a public key openssl rsa -in private.key -pubout > public.key
Alternatively, you can copy the pre-generated keys from the data folder
The pre-generated key were generated without a password.
Alternatively, you can generate the key anywhere in the project structure and specify the location of the keys in the config array under the key 'keys_folder'
Usage
In the routes.php file add the following entries:
Create the database schema using the included migration file: 20171107115657_oauth.php
Add a client:
Authorization
For the authorize method, performing a on the
will validate the URL and redirect to an authorize/deny page
Authorizing will redirect to the provided redirect URI with an authorization token
Posting to the URI with the following body fields:
will return a valid token which you can use multiple times, example:
Password
Add a user with
For the password method, performing a on the route with the following body:
will return an access token, example:
Access token usage
Piping the middleware to a route will verify the access token validity
A valid for
would have to contain the Authorization header. Example:
All versions of oauth2server with dependencies
bshaffer/oauth2-server-php Version ~1.8
dasprid/container-interop-doctrine Version 1.0.0
robmorgan/phinx Version ^0.9.1
symfony/http-foundation Version ^3.3
zendframework/zend-config-aggregator Version ^1.0
zendframework/zend-expressive Version ^2.0.2
zendframework/zend-servicemanager Version ^3.3
http-interop/http-server-handler Version ^1.0