Lines 650-655
sub checkauth {
Link Here
|
650 |
# This parameter is the name of the CAS server we want to authenticate against, |
650 |
# This parameter is the name of the CAS server we want to authenticate against, |
651 |
# when using authentication against multiple CAS servers, as configured in Auth_cas_servers.yaml |
651 |
# when using authentication against multiple CAS servers, as configured in Auth_cas_servers.yaml |
652 |
my $casparam = $query->param('cas'); |
652 |
my $casparam = $query->param('cas'); |
|
|
653 |
my $q_userid = $query->param('userid'); |
653 |
|
654 |
|
654 |
if ( $userid = $ENV{'REMOTE_USER'} ) { |
655 |
if ( $userid = $ENV{'REMOTE_USER'} ) { |
655 |
# Using Basic Authentication, no cookies required |
656 |
# Using Basic Authentication, no cookies required |
Lines 669-677
sub checkauth {
Link Here
|
669 |
my $session = get_session($sessionID); |
670 |
my $session = get_session($sessionID); |
670 |
C4::Context->_new_userenv($sessionID); |
671 |
C4::Context->_new_userenv($sessionID); |
671 |
my ($ip, $lasttime, $sessiontype); |
672 |
my ($ip, $lasttime, $sessiontype); |
|
|
673 |
my $s_userid; |
672 |
if ($session){ |
674 |
if ($session){ |
|
|
675 |
$s_userid = $session->param('id'); |
673 |
C4::Context::set_userenv( |
676 |
C4::Context::set_userenv( |
674 |
$session->param('number'), $session->param('id'), |
677 |
$session->param('number'), $s_userid, |
675 |
$session->param('cardnumber'), $session->param('firstname'), |
678 |
$session->param('cardnumber'), $session->param('firstname'), |
676 |
$session->param('surname'), $session->param('branch'), |
679 |
$session->param('surname'), $session->param('branch'), |
677 |
$session->param('branchname'), $session->param('flags'), |
680 |
$session->param('branchname'), $session->param('flags'), |
Lines 684-697
sub checkauth {
Link Here
|
684 |
$debug and printf STDERR "AUTH_SESSION: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ; |
687 |
$debug and printf STDERR "AUTH_SESSION: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ; |
685 |
$ip = $session->param('ip'); |
688 |
$ip = $session->param('ip'); |
686 |
$lasttime = $session->param('lasttime'); |
689 |
$lasttime = $session->param('lasttime'); |
687 |
$userid = $session->param('id'); |
690 |
$userid = $s_userid; |
688 |
$sessiontype = $session->param('sessiontype') || ''; |
691 |
$sessiontype = $session->param('sessiontype') || ''; |
689 |
} |
692 |
} |
690 |
if ( ( ($query->param('koha_login_context')) && ($query->param('userid') ne ($session->param('id') // '')) ) |
693 |
if ( ( $query->param('koha_login_context') && ($q_userid && $s_userid && $q_userid ne $s_userid) ) |
691 |
|| ( $cas && $query->param('ticket') ) ) { |
694 |
|| ( $cas && $query->param('ticket') ) ) { |
692 |
#if a user enters an id ne to the id in the current session, we need to log them in... |
695 |
#if a user enters an id ne to the id in the current session, we need to log them in... |
693 |
#first we need to clear the anonymous session... |
696 |
#first we need to clear the anonymous session... |
694 |
$debug and warn "query id = " . $query->param('userid') . " but session id = " . $session->param('id'); |
697 |
$debug and warn "query id = $q_userid but session id = $s_userid"; |
695 |
$session->flush; |
698 |
$session->flush; |
696 |
$session->delete(); |
699 |
$session->delete(); |
697 |
C4::Context->_unset_userenv($sessionID); |
700 |
C4::Context->_unset_userenv($sessionID); |
Lines 711-717
sub checkauth {
Link Here
|
711 |
logout_cas($query); |
714 |
logout_cas($query); |
712 |
} |
715 |
} |
713 |
} |
716 |
} |
714 |
elsif ( $lasttime < time() - $timeout ) { |
717 |
elsif ( $lasttime && ($lasttime < time() - $timeout) ) { |
715 |
# timed logout |
718 |
# timed logout |
716 |
$info{'timed_out'} = 1; |
719 |
$info{'timed_out'} = 1; |
717 |
$session->delete() if $session; |
720 |
$session->delete() if $session; |
Lines 759-765
sub checkauth {
Link Here
|
759 |
-value => $session->id, |
762 |
-value => $session->id, |
760 |
-HttpOnly => 1 |
763 |
-HttpOnly => 1 |
761 |
); |
764 |
); |
762 |
$userid = $query->param('userid'); |
765 |
$userid = $q_userid; |
763 |
my $pki_field = C4::Context->preference('AllowPKIAuth') // 'None'; |
766 |
my $pki_field = C4::Context->preference('AllowPKIAuth') // 'None'; |
764 |
if ( ( $cas && $query->param('ticket') ) |
767 |
if ( ( $cas && $query->param('ticket') ) |
765 |
|| $userid |
768 |
|| $userid |
766 |
- |
|
|