]> git.evergreen-ils.org Git - working/Evergreen.git/commit
LP#1348731: Optional Auth login nonce to differentiate same-username logins
authorBill Erickson <berick@esilibrary.com>
Tue, 8 Oct 2013 19:52:12 +0000 (15:52 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 25 Jul 2014 17:25:48 +0000 (10:25 -0700)
commit3639fa1acb6c63e3190108e5a9e339240fb2e833
tree64b380b4b9c8b3515b18a9d88a6199bbf0da4e80
parent946ded4283a2b3e77ae1369447cfebab750e200a
LP#1348731: Optional Auth login nonce to differentiate same-username logins

If multiple login attempts are made using the same username within a
very short period of time, a race condition exists where, upon
completion of the first login, the auth init cache data for any pending
logins are removed, since there can only be one instance of cached init
data per username.

This adds support for allowing the caller to pass in a random string
which is added to the cache key as a way to differentiate between logins
using the same username.

The seed is passed into auth init as an optional secondary parameter
and passed again (via the "nonce" argument) to auth complete to ensure
consistent cache keys across both interactions.

Example:

my $nonce = rand($$);

my $seed = request(
    'open-ils.auth',
    'open-ils.auth.authenticate.init', $username, $nonce );

my $response = request(
    'open-ils.auth',
    'open-ils.auth.authenticate.complete',
    {
        username => $username,
        password => md5_hex($seed . md5_hex($password)),
        type     => 'opac',
        nonce    => $nonce
    }
);

The race condition has been observed with the SIP2 gateway when
multiple devices have been configured to use the same account.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/c-apps/oils_auth.c