From deb9e754c588416b74a72972a70b9f92908a48a9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 May 2021 14:26:29 +0200 Subject: [PATCH] Bug 28417: Don't use C4::Auth_with_cas if CAS is not used We should follow the same pattern as ldap and not use C4::Auth_with_cas if the cas syspref is not turned on. --- C4/Auth.pm | 9 +++++---- C4/Auth_with_cas.pm | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index f281def2ce0..a248aabd12f 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -72,14 +72,14 @@ BEGIN { $ldap = C4::Context->config('useldapserver') || 0; $cas = C4::Context->preference('casAuthentication'); $caslogout = C4::Context->preference('casLogout'); - require C4::Auth_with_cas; # no import if ($ldap) { require C4::Auth_with_ldap; import C4::Auth_with_ldap qw(checkpw_ldap); } if ($cas) { - import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); + require C4::Auth_with_cas; # no import + import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multipleAuth getMultipleAuth); } } @@ -1392,8 +1392,9 @@ sub checkauth { if ($cas) { # Is authentication against multiple CAS servers enabled? - if ( C4::Auth_with_cas::multipleAuth && !$casparam ) { - my $casservers = C4::Auth_with_cas::getMultipleAuth(); + require C4::Auth_with_cas; + if ( multipleAuth() && !$casparam ) { + my $casservers = getMultipleAuth(); my @tmplservers; foreach my $key ( keys %$casservers ) { push @tmplservers, { name => $key, value => login_cas_url( $query, $key, $type ) . "?cas=$key" }; diff --git a/C4/Auth_with_cas.pm b/C4/Auth_with_cas.pm index 4a6d0557d00..7e6a1c310f9 100644 --- a/C4/Auth_with_cas.pm +++ b/C4/Auth_with_cas.pm @@ -35,7 +35,7 @@ BEGIN { require Exporter; $debug = $ENV{DEBUG}; @ISA = qw(Exporter); - @EXPORT = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); + @EXPORT = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multilpleAuth getMultipleAuth); } my $defaultcasserver; my $casservers; -- 2.20.1