|
Lines 41-49
use Koha::Patron::Consents;
Link Here
|
| 41 |
use POSIX qw/strftime/; |
41 |
use POSIX qw/strftime/; |
| 42 |
use List::MoreUtils qw/ any /; |
42 |
use List::MoreUtils qw/ any /; |
| 43 |
use Encode qw( encode is_utf8); |
43 |
use Encode qw( encode is_utf8); |
|
|
44 |
use C4::Auth_with_shibboleth; |
| 44 |
|
45 |
|
| 45 |
# use utf8; |
46 |
# use utf8; |
| 46 |
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout $shib $shib_login); |
47 |
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); |
| 47 |
|
48 |
|
| 48 |
BEGIN { |
49 |
BEGIN { |
| 49 |
sub psgi_env { any { /^psgi\./ } keys %ENV } |
50 |
sub psgi_env { any { /^psgi\./ } keys %ENV } |
|
Lines 62-68
BEGIN {
Link Here
|
| 62 |
%EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); |
63 |
%EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); |
| 63 |
$ldap = C4::Context->config('useldapserver') || 0; |
64 |
$ldap = C4::Context->config('useldapserver') || 0; |
| 64 |
$cas = C4::Context->preference('casAuthentication'); |
65 |
$cas = C4::Context->preference('casAuthentication'); |
| 65 |
$shib = C4::Context->config('useshibboleth') || 0; |
|
|
| 66 |
$caslogout = C4::Context->preference('casLogout'); |
66 |
$caslogout = C4::Context->preference('casLogout'); |
| 67 |
require C4::Auth_with_cas; # no import |
67 |
require C4::Auth_with_cas; # no import |
| 68 |
|
68 |
|
|
Lines 70-83
BEGIN {
Link Here
|
| 70 |
require C4::Auth_with_ldap; |
70 |
require C4::Auth_with_ldap; |
| 71 |
import C4::Auth_with_ldap qw(checkpw_ldap); |
71 |
import C4::Auth_with_ldap qw(checkpw_ldap); |
| 72 |
} |
72 |
} |
| 73 |
if ($shib) { |
|
|
| 74 |
require C4::Auth_with_shibboleth; |
| 75 |
import C4::Auth_with_shibboleth |
| 76 |
qw(shib_ok checkpw_shib logout_shib login_shib_url get_login_shib); |
| 77 |
|
| 78 |
# Check for good config |
| 79 |
$shib = 0 unless shib_ok(); |
| 80 |
} |
| 81 |
if ($cas) { |
73 |
if ($cas) { |
| 82 |
import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); |
74 |
import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); |
| 83 |
} |
75 |
} |
|
Lines 153-159
sub get_template_and_user {
Link Here
|
| 153 |
my ( $user, $cookie, $sessionID, $flags ); |
145 |
my ( $user, $cookie, $sessionID, $flags ); |
| 154 |
|
146 |
|
| 155 |
# Get shibboleth login attribute |
147 |
# Get shibboleth login attribute |
| 156 |
$shib_login = get_login_shib() if $shib; |
148 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
|
|
149 |
my $shib_login = $shib ? get_login_shib() : undef; |
| 157 |
|
150 |
|
| 158 |
C4::Context->interface( $in->{type} ); |
151 |
C4::Context->interface( $in->{type} ); |
| 159 |
|
152 |
|
|
Lines 786-792
sub checkauth {
Link Here
|
| 786 |
$debug and warn "Checking Auth"; |
779 |
$debug and warn "Checking Auth"; |
| 787 |
|
780 |
|
| 788 |
# Get shibboleth login attribute |
781 |
# Get shibboleth login attribute |
| 789 |
$shib_login = get_login_shib() if $shib; |
782 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
|
|
783 |
my $shib_login = $shib ? get_login_shib() : undef; |
| 790 |
|
784 |
|
| 791 |
# $authnotrequired will be set for scripts which will run without authentication |
785 |
# $authnotrequired will be set for scripts which will run without authentication |
| 792 |
my $authnotrequired = shift; |
786 |
my $authnotrequired = shift; |
|
Lines 1773-1778
sub checkpw {
Link Here
|
| 1773 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
1767 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
| 1774 |
$type = 'opac' unless $type; |
1768 |
$type = 'opac' unless $type; |
| 1775 |
|
1769 |
|
|
|
1770 |
# Get shibboleth login attribute |
| 1771 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
| 1772 |
my $shib_login = $shib ? get_login_shib() : undef; |
| 1773 |
|
| 1776 |
my @return; |
1774 |
my @return; |
| 1777 |
my $patron = Koha::Patrons->find({ userid => $userid }); |
1775 |
my $patron = Koha::Patrons->find({ userid => $userid }); |
| 1778 |
my $check_internal_as_fallback = 0; |
1776 |
my $check_internal_as_fallback = 0; |