]> git.koha-community.org Git - koha.git/commit
Bug 17050: Do not kick the session out when accessing the REST API
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 5 Aug 2016 15:03:28 +0000 (15:03 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 23 Aug 2016 13:45:07 +0000 (13:45 +0000)
commitb5fc3d29373d2b6eecd9f3d26c798d603dae7d84
treea596e97af76d266e346d57d6d6aabf5a93e64b41
parent3315a883ed055554627c26ace0581e8fd6426b83
Bug 17050: Do not kick the session out when accessing the REST API

Mojolicious does not set $ENV{REMOTE_ADDR} (neither $ENV{HTTP_*}) as
it may share ENV between different requests.
Fortunately for us, Plack does not!

This is a dirty patch to fix this issue but it seems that there is not
lot of solutions. It adds a remote_addr parameter to
C4::Auth::check_cookie_authin order to send it from
Koha::Rest::V1::startup reading the headers sent by Mojolicious.

Test plan:
Hit /cgi-bin/koha/mainpage.pl
Hit /api/v1/patrons/42
Hit /cgi-bin/koha/mainpage.pl

With this patch applied, everything will be fine and you won't be
logged out.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Auth.pm
Koha/REST/V1.pm