LP1526558 SIP authproxy avoid unnecessary call; docs user/berick/lp1526558-sip-auth-proxy
authorBill Erickson <berickxx@gmail.com>
Mon, 17 Aug 2020 15:15:47 +0000 (11:15 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 17 Aug 2020 15:31:39 +0000 (11:31 -0400)
Avoid the unnecessary call to see if the proxy is enabled when the proxy
will not be used anyway by the SIP client login.

Adds docs for the new use_proxy_for_client_login SIP server option.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index f0edf88..e5a2f7a 100644 (file)
                                        <option name='patron_status_always_permit_loans' value='false' />
                                        -->
 
+                                       <!--
+                                       Use the open-ils.auth_proxy service for when verifying
+                                       a patrons' password.
+                                       The 'open-ils.auth_proxy.enabled' API also must return true.
+                                       <option name='use_proxy_for_patron_auth' value='false' />
+                                       -->
+
+                                       <!--
+                                       Use the open-ils.auth_proxy service for SIP client logins
+                                       when the auth proxy is enabled.  Defaults to not using
+                                       the proxy for SIP client logins.
+                                       The 'open-ils.auth_proxy.enabled' API also must return true.
+                                       <option name='use_proxy_for_client_login' value='false' />
+                                       -->
+
                                </options>
 
                 <checkin_override>
index 0a1245f..9e3527d 100644 (file)
@@ -199,15 +199,18 @@ sub login {
     my $use_proxy_for_client_login = $self->get_option_value('use_proxy_for_client_login') || 'false';
 
     my $auth_proxy_enabled = 0;
-    eval {
-        $auth_proxy_enabled = $U->simplereq(
-            'open-ils.auth_proxy',
-            'open-ils.auth_proxy.enabled'
-        );
-    };
+
+    if ($use_proxy_for_client_login =~ /true/i) {
+        eval {
+            $auth_proxy_enabled = $U->simplereq(
+                'open-ils.auth_proxy',
+                'open-ils.auth_proxy.enabled'
+            );
+        };
+    }
 
     my $response;
-    if ($auth_proxy_enabled && $use_proxy_for_client_login =~ /true/i) {
+    if ($auth_proxy_enabled) {
         $response = $U->simplereq(
             'open-ils.auth_proxy',
             'open-ils.auth_proxy.login',
index eb4919f..0351778 100644 (file)
@@ -435,13 +435,19 @@ sub check_password {
     syslog('LOG_DEBUG', 'OILS: Patron->check_password()');
     return 0 unless (defined $pwd and $self->{user});
 
+    my $use_proxy_for_patron_auth = 
+        OpenILS::SIP->get_option_value('use_proxy_for_patron_auth') || 'false';
+
     my $auth_proxy_enabled = 0;
-    eval {
-        $auth_proxy_enabled = $U->simplereq(
-            'open-ils.auth_proxy',
-            'open-ils.auth_proxy.enabled'
-        );
-    };
+
+    if ($use_proxy_for_patron_auth =~ /true/i) {
+        eval {
+            $auth_proxy_enabled = $U->simplereq(
+                'open-ils.auth_proxy',
+                'open-ils.auth_proxy.enabled'
+            );
+        };
+    }
 
     if ($auth_proxy_enabled) {
         my $response = $U->simplereq(