From 17e3dcbec6b7a6da306774fe8f423529e9c31a63 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 9 Oct 2013 11:36:52 -0400 Subject: [PATCH] Have Evergreen save authtoken state to support IO::Multiplex mode Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm index 8098d84a9d..d13c9923af 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm @@ -47,7 +47,7 @@ sub disconnect { } sub new { - my ($class, $institution, $login) = @_; + my ($class, $institution, $login, $state) = @_; my $type = ref($class) || $class; my $self = {}; @@ -76,7 +76,7 @@ sub new { bless( $self, $type ); return undef unless - $self->login( $login->{id}, $login->{password} ); + $self->login( $login->{id}, $login->{password}, $state ); return $self; } @@ -224,9 +224,15 @@ sub format_date { sub login { - my( $self, $username, $password ) = @_; + my( $self, $username, $password, $state ) = @_; syslog('LOG_DEBUG', "OILS: Logging in with username $username"); + + if ($state and ref $state and $$state{authtoken}) { + $self->{authtoken} = $$state{authtoken}; + return $self->{authtoken} if ($self->fetch_session); # fetch the session + } + my $nonce = rand($$); my $seed = $U->simplereq( 'open-ils.auth', @@ -259,6 +265,10 @@ sub login { return $key; } +sub state { + return { authtoken => $self->{authtoken} }; +} + # # find_patron($barcode); # find_patron(barcode => $barcode); # same as above -- 2.11.0