From bf1c4c24316a608cfce6edb5551787756f016a69 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. Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Jonathan Druart --- 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 d6cd32d3eb..df0cf31425 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); } } @@ -1340,8 +1340,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 8c922ece6a..dd02afc9ae 100644 --- a/C4/Auth_with_cas.pm +++ b/C4/Auth_with_cas.pm @@ -33,7 +33,7 @@ our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT_OK = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); + @EXPORT_OK = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multilpleAuth getMultipleAuth); } my $defaultcasserver; my $casservers; -- 2.39.5