Skip to content

Commit fd48045

Browse files
committed
update README
1 parent 4ed40ad commit fd48045

1 file changed

Lines changed: 73 additions & 3 deletions

File tree

README.md

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ A plugin for implementing an OAuth2 server in CakePHP 3. Built on top of the [PH
77

88
This repository is a fork of [uafrica/oauth-server](https://github.com/uafrica/oauth-server).
99

10+
## Requirements
11+
12+
- PHP >= 7.1 with openssl extension
13+
- CakePHP >= 3.5
14+
- Database (MySQL, SQLite tested)
15+
1016
## Installation
1117

1218
You can install this plugin into your CakePHP application using. Run:
@@ -19,13 +25,13 @@ composer require elstc/cakephp-oauth-server
1925

2026
(CakePHP >= 3.6.0) Load the plugin by adding the following statement in your project's `src/Application.php`:
2127

22-
```
28+
```php
2329
$this->addPlugin('OAuthServer');
2430
```
2531

2632
(CakePHP <= 3.5.x) Load the plugin by adding the following statement in your project's `config/bootstrap.php` file:
2733

28-
```
34+
```php
2935
Plugin::load('OAuthServer', ['bootstrap' => true, 'route' => true]);
3036
```
3137

@@ -55,7 +61,7 @@ vendor/bin/generate-defuse-key
5561

5662
Change your app.php, Add `OAuthServer` configuration :
5763

58-
```bash
64+
```php
5965
'OAuthServer' => [
6066
'privateKey' => CONFIG . 'oauth.pem',
6167
'publicKey' => CONFIG . 'oauth.pub',
@@ -371,3 +377,67 @@ The server also fires a number of events that can be used to inject values into
371377
* `OAuthServer.afterDeny` - On the user denying the client
372378

373379
You can customise the OAuth authorise page by creating a overriding template file in `src/Template/Plugin/OAuthServer/OAuth/authorize.ctp`
380+
381+
### Component/Authenticator Options
382+
383+
- `OAuthServer.privateKey`
384+
385+
REQUIRED: Set your private key filepath.
386+
387+
The key file should be don't readable other user. (file permission is `400`, `440`, `600`, `640`, `660`)
388+
389+
- `OAuthServer.publicKey`
390+
391+
REQUIRED: Set your public key filepath. That generated from the above private key.
392+
393+
The key file should be don't readable other user. (file permission is `400`, `440`, `600`, `640`, `660`)
394+
395+
- `OAuthServer.encryptionKey`
396+
397+
REQUIRED: Set your encryption key string. That generated from `vendor/bin/generate-defuse-key` command.
398+
399+
- `OAuthServer.accessTokenTTL`
400+
401+
Optional: Set access token TTL. Specify a format that can be interpreted by the [DateInterval](https://www.php.net/manual/en/dateinterval.construct.php) class.
402+
403+
default: `PT1H` (1 hour)
404+
405+
- `OAuthServer.refreshTokenTTL`
406+
407+
Optional: Set refresh token TTL. Specify a format that can be interpreted by the [DateInterval](https://www.php.net/manual/en/dateinterval.construct.php) class.
408+
409+
default: `P1M` (1 month)
410+
411+
- `OAuthServer.authCodeTTL`
412+
413+
Optional: Set auth code TTL. Specify a format that can be interpreted by the [DateInterval](https://www.php.net/manual/en/dateinterval.construct.php) class.
414+
415+
default: `PT10M` (10 minutes)
416+
417+
- `OAuthServer.supportedGrants`
418+
419+
Optional: Set supported grant types. This option can be the following list: `AuthCode`, `RefreshToken`, `ClientCredentials`, `Password`.
420+
421+
default: `['AuthCode', 'RefreshToken', 'ClientCredentials', 'Password']`
422+
423+
- `OAuthServer.passwordAuthenticator`
424+
425+
Optional: Set Authenticator that use password grant. Set this if your application uses a non default authenticator.
426+
427+
default: `Form`
428+
429+
### OAuthAuthenticate Options
430+
431+
- `continue`
432+
433+
Optional: If set to false, if OAuth authentication fails, stop processing there.
434+
435+
default: `true`
436+
437+
- `fields.username`
438+
439+
Optional: Specify the user's primary key field.
440+
441+
default: `id`
442+
443+
more configuration options see: https://book.cakephp.org/3.0/en/controllers/components/authentication.html#configuring-authentication-handlers

0 commit comments

Comments
 (0)