|
Lines 48-54
use Koha::Patrons;
Link Here
|
| 48 |
use Koha::Patron::Consents; |
48 |
use Koha::Patron::Consents; |
| 49 |
use List::MoreUtils qw( any ); |
49 |
use List::MoreUtils qw( any ); |
| 50 |
use Encode; |
50 |
use Encode; |
| 51 |
use C4::Auth_with_shibboleth qw( shib_ok get_login_shib login_shib_url logout_shib checkpw_shib ); |
51 |
use C4::Auth_with_shibboleth qw( shib_ok get_login_shib login_shib_url logout_shib ); |
| 52 |
use Net::CIDR; |
52 |
use Net::CIDR; |
| 53 |
use C4::Log qw( logaction ); |
53 |
use C4::Log qw( logaction ); |
| 54 |
use Koha::CookieManager; |
54 |
use Koha::CookieManager; |
|
Lines 78-86
BEGIN {
Link Here
|
| 78 |
$caslogout = C4::Context->preference('casLogout'); |
78 |
$caslogout = C4::Context->preference('casLogout'); |
| 79 |
|
79 |
|
| 80 |
if ($cas) { |
80 |
if ($cas) { |
| 81 |
require C4::Auth_with_cas; # no import |
81 |
require C4::Auth_with_cas; # no import - legacy functions still needed |
| 82 |
import C4::Auth_with_cas |
82 |
import C4::Auth_with_cas qw(check_api_auth_cas login_cas logout_cas login_cas_url logout_if_required); |
| 83 |
qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multipleAuth getMultipleAuth); |
83 |
|
|
|
84 |
# Use modern CAS compatibility layer for authentication |
| 85 |
require Koha::Auth::CASCompat; |
| 84 |
} |
86 |
} |
| 85 |
|
87 |
|
| 86 |
} |
88 |
} |
|
Lines 152-160
BEGIN {
Link Here
|
| 152 |
$caslogout = C4::Context->preference('casLogout'); |
154 |
$caslogout = C4::Context->preference('casLogout'); |
| 153 |
|
155 |
|
| 154 |
if ($cas) { |
156 |
if ($cas) { |
| 155 |
require C4::Auth_with_cas; # no import |
157 |
require C4::Auth_with_cas; # no import - legacy functions still needed |
| 156 |
import C4::Auth_with_cas |
158 |
import C4::Auth_with_cas qw(check_api_auth_cas login_cas logout_cas login_cas_url logout_if_required); |
| 157 |
qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multipleAuth getMultipleAuth); |
159 |
|
|
|
160 |
# Use modern CAS compatibility layer for authentication |
| 161 |
require Koha::Auth::CASCompat; |
| 158 |
} |
162 |
} |
| 159 |
|
163 |
|
| 160 |
} |
164 |
} |
|
Lines 1566-1574
sub checkauth {
Link Here
|
| 1566 |
if ($cas) { |
1570 |
if ($cas) { |
| 1567 |
|
1571 |
|
| 1568 |
# Is authentication against multiple CAS servers enabled? |
1572 |
# Is authentication against multiple CAS servers enabled? |
| 1569 |
require C4::Auth_with_cas; |
1573 |
my ( $default_cas, $casservers ) = Koha::Auth::CASCompat::get_cas_providers(); |
| 1570 |
if ( multipleAuth() && !$casparam ) { |
1574 |
if ( keys %$casservers > 1 && !$casparam ) { |
| 1571 |
my $casservers = getMultipleAuth(); |
|
|
| 1572 |
my @tmplservers; |
1575 |
my @tmplservers; |
| 1573 |
foreach my $key ( keys %$casservers ) { |
1576 |
foreach my $key ( keys %$casservers ) { |
| 1574 |
push @tmplservers, { name => $key, value => login_cas_url( $query, $key, $type ) . "?cas=$key" }; |
1577 |
push @tmplservers, { name => $key, value => login_cas_url( $query, $key, $type ) . "?cas=$key" }; |
|
Lines 2099-2107
sub checkpw {
Link Here
|
| 2099 |
|
2102 |
|
| 2100 |
# In case of a CAS authentication, we use the ticket instead of the password |
2103 |
# In case of a CAS authentication, we use the ticket instead of the password |
| 2101 |
my $ticket = $query->param('ticket'); |
2104 |
my $ticket = $query->param('ticket'); |
| 2102 |
$query->delete('ticket'); # remove ticket to come back to original URL |
2105 |
$query->delete('ticket'); # remove ticket to come back to original URL |
|
|
2106 |
my $cas_server = $query->param('cas'); # Get CAS server parameter |
| 2107 |
|
| 2108 |
# Ensure CASCompat is loaded (needed for tests that set $cas after module load) |
| 2109 |
require Koha::Auth::CASCompat; |
| 2110 |
|
| 2103 |
my ( $retval, $retcard, $retuserid, $cas_ticket ); |
2111 |
my ( $retval, $retcard, $retuserid, $cas_ticket ); |
| 2104 |
( $retval, $retcard, $retuserid, $cas_ticket, $patron ) = checkpw_cas( $ticket, $query, $type ); # EXTERNAL AUTH |
2112 |
( $retval, $retcard, $retuserid, $cas_ticket, $patron ) = |
|
|
2113 |
Koha::Auth::CASCompat::authenticate_cas_user( $ticket, $query, $type, $cas_server ); # EXTERNAL AUTH |
| 2105 |
if ($retval) { |
2114 |
if ($retval) { |
| 2106 |
@return = ( $retval, $retcard, $retuserid, $patron, $cas_ticket ); |
2115 |
@return = ( $retval, $retcard, $retuserid, $patron, $cas_ticket ); |
| 2107 |
} else { |
2116 |
} else { |
|
Lines 2121-2129
sub checkpw {
Link Here
|
| 2121 |
|
2130 |
|
| 2122 |
# Then, we check if it matches a valid koha user |
2131 |
# Then, we check if it matches a valid koha user |
| 2123 |
if ($shib_login) { |
2132 |
if ($shib_login) { |
|
|
2133 |
|
| 2134 |
# Ensure ShibbolethCompat is loaded (needed for tests that set $shib after module load) |
| 2135 |
require Koha::Auth::ShibbolethCompat; |
| 2136 |
|
| 2124 |
my ( $retval, $retcard, $retuserid ); |
2137 |
my ( $retval, $retcard, $retuserid ); |
| 2125 |
( $retval, $retcard, $retuserid, $patron ) = |
2138 |
( $retval, $retcard, $retuserid, $patron ) = |
| 2126 |
C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH |
2139 |
Koha::Auth::ShibbolethCompat::authenticate_shibboleth_user($shib_login); # EXTERNAL AUTH |
| 2127 |
if ($retval) { |
2140 |
if ($retval) { |
| 2128 |
@return = ( $retval, $retcard, $retuserid, $patron ); |
2141 |
@return = ( $retval, $retcard, $retuserid, $patron ); |
| 2129 |
} |
2142 |
} |
| 2130 |
- |
|
|