Add authenticate method to OpenILS::Utils::Cronscript.

Bug #884398 reported by Jason Stephenson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Wishlist
Dan Scott

Bug Description

In order to make Cronscript a tad bit more useful for those of us who write a lot of custom scripts, I added an authenticate method to Cronscript as well as authtoken and authtime methods.

The new authenticate method takes a hashref of almost the same arguments as open-ils.auth.authenticate.complete. The password is expected to be sent in plain text.

The authenticate method then does the auth.init/auth.complete dance and returns the authtoken on success, or undef on failure. It also stores the authtime and authtoken on the cronscript object for later retrieval if need be.

As always any suggestions ideas, etc. are welcome.

For sharing cronscript_authenticate via the remote repo jason:

You need only add the remote once, regardless of how many branches you wish to look at.
To add this repo as jason:
 Read-only (git protocol):
  git remote add jason git://git.mvlcstaff.org/jason/ILS
 Read-write (ssh protocol):
  git remote add jason <email address hidden>:jason/ILS

Once you have the remote added you can check out this branch:
git checkout -b cronscript_authenticate jason/cronscript_authenticate

For sharing cronscript_authenticate via the remote repo working:

You need only add the remote once, regardless of how many branches you wish to look at.
To add this repo as working:
 Read-only (git protocol):
  git remote add working git://git.evergreen-ils.org/working/Evergreen
 Read-write (ssh protocol):
  git remote add working <email address hidden>:working/Evergreen

Once you have the remote added you can check out this branch:
git checkout -b cronscript_authenticate working/user/dyrcona/cronscript_authenticate

Revision history for this message
Jason Stephenson (jstephenson) wrote :

A sample script to exercise the new functionality:

#!/usr/bin/perl

use OpenILS::Utils::Cronscript;

my $script = OpenILS::Utils::Cronscript->new();

my $login = {
             username => $ARGV[0],
             password => $ARGV[1],
             workstation => $ARGV[2]
            };

my $authtoken = $script->authenticate($login);

print($script->authtoken . "\n");
print($script->authtime . "\n");

Changed in evergreen:
importance: Undecided → Wishlist
Revision history for this message
Dan Scott (denials) wrote :

Looks great - pushed to master. Thanks Jason!

Changed in evergreen:
milestone: none → 2.2.0
assignee: nobody → Dan Scott (denials)
status: New → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.