Download the PHP package salines/oauth-server without Composer
On this page you can find all versions of the php package salines/oauth-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download salines/oauth-server
More information about salines/oauth-server
Files in salines/oauth-server
Package oauth-server
Short Description OAuth Server for CakePHP 3 using the PHP League's OAuth2 Server
License MIT
Informations about the package oauth-server
OAuth2 Server for CakePHP 3
A plugin for implementing an OAuth2 server in CakePHP 3. Built on top of the PHP League's OAuth2 Server. Currently we support the following grant types: AuthCode, RefreshToken, ClientCredentials.
Installation
Installation is done using composer. Run:
Once composer has installed the package, the plugin needs to be activated by running:
Finally the database migrations need to be run.
Configuration
It is assumed that you already have working Form based authentication using the built in CakePHP 3 authentication component. If you do not, please read the authentication chapter.
Set OAuthServer as an authentication adaptor.
In your AppController::beforeFilter()
method, add (or modify)
Change your login method to look as follows:
Alternatively, if you are using the Friends Of Cake CRUD plugin, add
to your CRUD actions config.
Usage
The base OAuth2 path is example.com/oauth
.
In order to add clients and OAuth scopes you need to create a ClientsController
and a ScopesController
(Which is not part of this plugin)
The simplest way is to make use of the Friends Of Cake CRUD-View plugin.
Install it by running
Then create a ClientsController
that looks like:
And a ScopesController
that looks like:
Customisation
The OAuth2 Server can be customised, the look for the various pages can be changed by creating templates in Template/Plugin/OAuthServer/OAuth
The server also fires a number of events that can be used to inject values into the process. The current events fired are:
OAuthServer.beforeAuthorize
- On rendering of the approval page for the user.OAuthServer.afterAuthorize
- On the user authorising the clientOAuthServer.afterDeny
- On the user denying the clientOAuthServer.getUser
- On loading user details for authentication requests.
You can customise the OAuth authorise page by creating a overriding template file in src/Template/Plugin/OAuthServer/OAuth/authorize.ctp
All versions of oauth-server with dependencies
cakephp/cakephp Version ~3.0
league/oauth2-server Version ~4.1
cakephp/migrations Version ~1.0