Bugzilla – Attachment 105639 Details for
Bug 22522
API authentication breaks with updated Mojolicious version
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22522: Add support for current Mojolicious in 19.11
Bug-22522-Add-support-for-current-Mojolicious-in-1.patch (text/plain), 1.93 KB, created by
Martin Renvoize (ashimema)
on 2020-06-08 12:13:49 UTC
(
hide
)
Description:
Bug 22522: Add support for current Mojolicious in 19.11
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-08 12:13:49 UTC
Size:
1.93 KB
patch
obsolete
>From 963a7e25d0db4e1ca89de27e217e2bb9476d8f25 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 8 Jun 2020 13:11:50 +0100 >Subject: [PATCH] Bug 22522: Add support for current Mojolicious in 19.11 > >This patch allows tests to succeed with the following versions: >JSON::Validator 3.18 >Mojolicious 8.32 >Mojolicious::Plugin::OpenAPI 2.21 > >Also Mojolicious::Plugin::OpenAPI version 1.17 and later 1.x versions >now work. > >Calling valid_input in under() would cause ' Use of uninitialized value >$_[2] ' in more recent OpenAPI plugins, so that was changed too. As far >as I can see this does not affect authorization. >--- > Koha/REST/V1/Auth.pm | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index 8bffc977da..b20b9c8823 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -55,14 +55,14 @@ This subroutine is called before every request to API. > =cut > > sub under { >- my $c = shift->openapi->valid_input or return;; >+ my ( $c ) = @_; > > my $status = 0; > > try { > > # /api/v1/{namespace} >- my $namespace = $c->req->url->to_abs->path->[2]; >+ my $namespace = $c->req->url->to_abs->path->[2] // ''; > > if ( $namespace eq 'public' > and !C4::Context->preference('RESTPublicAPI') ) >@@ -136,7 +136,10 @@ sub authenticate_api_request { > > my $user; > >- my $spec = $c->match->endpoint->pattern->defaults->{'openapi.op_spec'}; >+ # The following supports retrieval of spec with Mojolicious::Plugin::OpenAPI@1.17 and later (first one) >+ # and older versions (second one). >+ # TODO: remove the latter 'openapi.op_spec' if minimum version is bumped to at least 1.17. >+ my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'}; > my $authorization = $spec->{'x-koha-authorization'}; > > my $authorization_header = $c->req->headers->authorization; >-- >2.20.1
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 22522
:
86756
|
93592
|
98061
|
98089
|
98372
|
98557
|
98558
|
98559
|
98665
|
98666
|
98667
|
99181
|
99182
|
99183
|
105591
|
105639
|
105657
|
105658
|
105659
|
105692