Basic test authenticator for AuthProxy user/jeffdavis/auth_proxy_test
authorJeff Davis <jeff.davis@bc.libraries.coop>
Mon, 6 Jul 2020 18:32:57 +0000 (11:32 -0700)
committerJeff Davis <jeff.davis@bc.libraries.coop>
Mon, 6 Jul 2020 18:32:57 +0000 (11:32 -0700)
Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy/Test.pm [new file with mode: 0644]

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy/Test.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy/Test.pm
new file mode 100644 (file)
index 0000000..9fb62c3
--- /dev/null
@@ -0,0 +1,30 @@
+package OpenILS::Application::AuthProxy::Test;
+use strict;
+use warnings;
+use base 'OpenILS::Application::AuthProxy::AuthBase';
+use OpenILS::Event;
+
+sub authenticate {
+    my ( $self, $args ) = @_;
+    my $username = $args->{username};
+    my $password = $args->{password};
+
+    if (!$username or !$password) {
+        return OpenILS::Event->new('LOGIN_FAILED');
+    }
+
+    my $logins = {
+        # no native Evergreen account
+        '99999393000' => 'nonexistentbarcode',
+        # valid account, AuthProxy password differs from EG password
+        '99999393004' => 'authproxypassword'
+    };
+
+    if (exists $logins->{$username} and $logins->{$username} eq $password) {
+        return OpenILS::Event->new('SUCCESS');
+    } else {
+        return OpenILS::Event->new('LOGIN_FAILED');
+    }
+}
+
+1;