LP#1710949 open-ils.auth.login API
authorBill Erickson <berickxx@gmail.com>
Tue, 15 Aug 2017 17:13:03 +0000 (13:13 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 15 Aug 2017 19:00:18 +0000 (15:00 -0400)
commit5b42a31d1431e7f3098d151f3f6ca7b76124d70f
tree811ab41245fadc8a85e5610f65b1315a17cc970d
parentc5838c87c0f20f1ba01ce525d30c1637751d85e2
LP#1710949 open-ils.auth.login API

Adds a new open-ils.auth API call 'open-ils.auth.login' which performs
the combined steps of open-ils.auth.authenticate.init and
open-ils.auth.authenticate.complete so the caller only need call one API
to login.

API params are consistent with open-ils.auth.authenticate.complete with
2 notable excpetions.  The API uses the bare password instead of the
hashed password, so the caller also need not perform the extra hashing
steps.  Also, no 'nonce' parameter is used as it's no longer needed,
because there is no intermediate authentication cache object as with
.init.

Response data is consistent with open-ils.auth.authenticate.complete.

Example:

srfsh# request open-ils.auth open-ils.auth.login {"username":"admin","password":"fakepassword"}

Other changes in the new code:

1. Using the generic "identifier" parameter in combination with the
   "org" parameter allows the API to reliably determine if a value
   is a username or barcode.

2. Once a caller has reached the configured maximum number of login
   failures, no further attempts to track failures occurs, based on the
   idea that no additional cpu/network cycles should be used on a lost
   cause.

3. A failure count object is only added to memcache when failures
   occur, unlike open-ils.auth.authenticate.init which creates a
   failure tracking object for every login.

4. The code avoids use of the jsonParseFmt() and va_list_to_string()
   functions as these functions require extra data cleansing.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/c-apps/oils_auth.c