Bug 20624: Make /api/v1/oauth/token respect RESTOAuth2ClientCredentials
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 2 May 2018 18:51:38 +0000 (15:51 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 May 2018 15:56:02 +0000 (12:56 -0300)
commit997a5705504b63cbaf9ae41f0487f5c1654c686f
treebecc08e9908b2346b5a89711e77786878ef047ca
parentde0698076fee3061d3c37a8a922faf19a69336c8
Bug 20624: Make /api/v1/oauth/token respect RESTOAuth2ClientCredentials

This patch makes the /api/v1/oauth/token enpoint respect the
RESTOAuth2ClientCredentials syspref. It will return 400 (with
'Unimplemented grant type' error message) on the event of the syspref
being disabled and the grant_type => 'client_credentials' value passed.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/oauth.t
=> FAIL: It fails because the off-switch is not implemented
- Apply this patch
- Run:
  k$ prove t/db_dependent/api/v1/oauth.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/V1/OAuth.pm