Bugzilla – Attachment 74988 Details for
Bug 20624
Disable the OAuth2 client credentials grant by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20624: Make /api/v1/oauth/token respect RESTOAuth2ClientCredentials
Bug-20624-Make-apiv1oauthtoken-respect-RESTOAuth2C.patch (text/plain), 1.36 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-05-02 19:00:34 UTC
(
hide
)
Description:
Bug 20624: Make /api/v1/oauth/token respect RESTOAuth2ClientCredentials
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-05-02 19:00:34 UTC
Size:
1.36 KB
patch
obsolete
>From aefdeda4f5f42c5bfb32106dcf201d09cd873c85 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 2 May 2018 15:51:38 -0300 >Subject: [PATCH] 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 >--- > Koha/REST/V1/OAuth.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/OAuth.pm b/Koha/REST/V1/OAuth.pm >index 727838bf2e..d201f8818b 100644 >--- a/Koha/REST/V1/OAuth.pm >+++ b/Koha/REST/V1/OAuth.pm >@@ -13,7 +13,7 @@ sub token { > my $c = shift->openapi->valid_input or return; > > my $grant_type = $c->validation->param('grant_type'); >- unless ($grant_type eq 'client_credentials') { >+ unless ( $grant_type eq 'client_credentials' and C4::Context->preference('RESTOAuth2ClientCredentials') ) { > return $c->render(status => 400, openapi => {error => 'Unimplemented grant type'}); > } > >-- >2.17.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20624
:
74986
|
74987
|
74988
|
74989
|
75020
|
75021
|
75060
|
75061
|
75062
|
75063
|
75064
|
75065
|
75132
|
75184
|
75206