Configuring EZproxy to use III Patron API

From WCN

Jump to: navigation, search

A typical, basic III user.txt entry is:

 ::III
 Host iii.yourlib.org
 IfUnauthenticated; Stop
 /III

where the "user" field provided by the user is typically the barcode. To populate the user field in the User Object, add the following Set directive:

 ::III
 Host iii.yourlib.org
 IfUnauthenticated; Stop
 Set session:uid = login:user
 /III

III systems release additional information which is exposed by EZproxy using the auth: namespace on EZproxy variables. A common III variable is the personal name, which is released as auth:pn. To parse the name into the User Object, you might add:

 ::III
 Host iii.yourlib.org
 IfUnauthenticated; Stop
 Set session:uid = login:user
 Set ParseName(auth:pn, "S,FM,X", "session")
 /III

Which directs EZproxy to take the auth:pn variables and parse it looking for surname, forename, middle name, and suffix, all separated by commas. Name format is based on local practice, so the F M S X can be rearranged with commas to match local conventions.

The institution may want to block borrowing based on certain local conditions from III values. The following demonstrates allowing access only if there are no message blocks (p56) and if the patron type (p47) is one of the specified codes.

 ::III
 Host iii.yourlib.org
 IfUnauthenticated; Stop
 Set session:uid = login:user
 Set ParseName(auth:pn, "S,FM,X", "session")
# Assume circulation blocked by default Set session:bannedInRemoteCirculation = "Y"
# then unblock for specific conditions If auth:p56 eq "-" && auth:p47 =~ ^(2|3|4|5|6|15|16|17|18|19)$/" { Set session:bannedInRemoteCirculation = "N" } /III


[edit] A known working III API user.txt configuration example

Be sure to replace "Host my.III_API_SERVER.edu:PORT" with the hostname and port of your III server.

 #################
 ## Admin Users ##
 #################
 xxxx:XXXXXX:admin 
 ::III Not IfUser -RE [<0-9]+; Stop Date mdy Host my.III_API_SERVER.edu:PORT
# PatronAPI may be down IfRefused; Deny irefused.htm
# Patron's Account is expired IfExpired; Deny iexpired.htm
ifUnauthneticated; Stop
# The \ at the end of the IfType line allows this test to continue # on the following line, as though this were a single, very long line # # The end result is that the following Ptypes will be denied and will be redirected # itype.htm which is a locally created HTML notification page. # # The following information is for the purposes of an example only. If you choose # to use this logic then replace your own institutional Ptypes. IfType 0,3,22,24,32,34,35,40,41,42,43,44,100,200,201,202,203,204,205,206,207,210,\ 220,230,231,232,233,234,235,236,240,255; Deny itype.htm
# uid set to unique id field Set session:uid = auth:pu
# location set to homelibr Set session:location = auth:p53
# email set to emailaddr Set session:emailAddress = auth:pz
# ptype set to category Set session:category = auth:p47
# set the date format style for summit nre Set session:dateFormat = "MM-DD-YY"
# created date set to joinDate Set session:joinDate = auth:p83
# expiration date set to expiryDate Set session:expiryDate = auth:p43
# Set Summit Group Number and WorldCat Institution Number Set session:groupNumber = XXXXX Set session:instNumber = XXXXX
# Block Users with an MBlock or Invalid P-Type Set session:bannedInRemoteCirculation = "Y"
If auth:p56 eq "-" && auth:p47 =~ "/^1|2|10|11|12|13|14|15|20|21|31|36|211|212|213|214|216)$/" { Set session:bannedInRemoteCirculation = "N" }
# Parse the Patron's Name Set ParseName(auth:pn, "S, FM, X", "session") /III