From 21262c84bce8c689c9ce33ffe847a7bdd798a322 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 6 Jul 2020 11:32:57 -0700 Subject: [PATCH] Basic test authenticator for AuthProxy Signed-off-by: Jeff Davis --- .../lib/OpenILS/Application/AuthProxy/Test.pm | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy/Test.pm 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 index 0000000000..9fb62c36f5 --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AuthProxy/Test.pm @@ -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; -- 2.11.0