From 3798b73a1625f4ea61dd3b206ff479cf39140317 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 9 Oct 2013 11:36:52 -0400 Subject: [PATCH] LP#1339190: Have Evergreen save authtoken state to support IO::Multiplex mode Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 17 ++++++++++++++--- 1 file changed, 14 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..664bb6288b 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,11 @@ sub login { return $key; } +sub state { + my $self = shift; + return { authtoken => $self->{authtoken} }; +} + # # find_patron($barcode); # find_patron(barcode => $barcode); # same as above -- 2.11.0