Bug 28417: Don't require C4::Auth_with_cas from opac-user if not needed

Note that without the use URI::QueryParam statement in C4::Auth we get:
Can't locate object method "query_param_delete" via package "URI::_generic" at /kohadevbox/koha/C4/Auth.pm line 1254

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-11-03 13:43:11 +01:00
parent e0931d1004
commit 37005486d3
3 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,8 @@ use Carp qw( croak );
use Digest::MD5 qw( md5_base64 );
use CGI::Session;
use URI;
use URI::QueryParam;
use C4::Context;
use C4::Templates; # to get the template

View File

@ -25,6 +25,7 @@ use Koha::AuthUtils qw( get_script_name );
use Authen::CAS::Client;
use CGI qw ( -utf8 );
use YAML::XS;
use URI::Escape;
use Koha::Logger;

View File

@ -57,8 +57,10 @@ my $query = CGI->new;
# CAS single logout handling
# Will print header and exit
require C4::Auth_with_cas;
C4::Context->preference('casAuthentication') and C4::Auth_with_cas::logout_if_required($query);
if ( C4::Context->preference('casAuthentication') ) {
require C4::Auth_with_cas;
C4::Auth_with_cas::logout_if_required($query);
}
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{