Single sign-on and MyLibrary

We are playing with single sign-on technology here at the University Libraries of Notre Dame, and its implementation makes putting the “my” into MyLibrary almost trivial.

More specifically, we are experimenting with a thing called CAS (Central Authentication Service). It is relatively easy to install. Download WAR file. Drop it into your Java servlette container. Configure it to interact with your local authentication mechanism. (We use Kerberos.) Add CAS module to Apache. Configure specific directories to require authentication. Go.

When people access an authentication-required page on your Apache server and they are not authenticated, Apache redirects them to a login page. Enter username and password. Upon authentication a session-based cookie is saved to their browser as well as their username. No passwords are recorded in this process. Users are then returned to the initial page where your script can read their cookie, or in the case of Apache, read the remote_user environment variable. Using these values (remote_user or the cookie) as keys, you can then lookup patron information using MyLibrary::Patron.

Assuming you have pre-populated a MyLibrary instance with patrons, here is a “Hello, World!” sort of application using CAS authentication and MyLibrary:

#!/usr/bin/perl

# require
use CGI;
use MyLibrary::Core;
use MyLibrary::Patron;
use strict;

# define
use constant INSTANCE => 'mylibrary';

# initialize
my $cgi  = CGI->new;
MyLibrary::Config->instance( INSTANCE );

# get the patron's id
my $user_id = uc( $cgi->remote_user );
my $patron  = MyLibrary::Patron->new( username => $user_id );

# build a response
my $html = $cgi->p( 'Hello, ' . $patron->patron_firstname . '!' );

# return the response and done
print $cgi->header;
print $html;
exit;

Once you know a username, you can map it to related terms with the patron_terms method. From the list of returned terms you can retrieve lists of information resources, librarians, classes, etc to with which to populate a person’s page.

Discussion Area - Leave a Comment

You must be logged in to post a comment.