E-resource URL hacking for fun and profit: how to build direct, reliable login links to journals

Posted on March 9th, 2012 by Paul Stainthorp

I’ve got a bee in my bonnet about electronic resources which make it difficult or impossible to create reliable deep-ish links to a particular bit of the resource from Library websites (usually our library catalogue or EBSCO’s e-journals A-to-Z/link resolver) – links which handle the authentication properly and take the user to the place they wanted to go in the first place, and which do so consistently.

Below is an example of the kind of process we go through to construct direct, reliable login links to the home pages of journals, when authentication is via Athens and/or the UK Access Management Federation (UKAMF). The process uses a facility the A-to-Z has to rewrite URLs according to a set of predictable rules, generating a new login link which is a function of the original URL.

N.B. it’s only possible to do this at all if the Athens/UKAMF authentication point for the journal has a predictable structure. If a login URL includes any randomly-generated or unknown elements which vary from journal to journal, then it can’t be generated by predictable rules. If the login URL can’t be expressed as a predictable function of the basic URL for the journal, then we won’t able to create a direct, reliable login link for the resource. Some providers rule themselves out at the first hurdle because of this, and it’s intensely irritating for me and even more so for users.

This whole process should get easier (and the end result less frustrating for users) when we introduce EZproxy as an additional authentication tool, but even so I would say that the ability to analyse, deconstruct, rewrite and generally hack URLs is one of the most important skills needed by anyone who works with e-resources.

Here’s how to build a direct, reliable login link via Athens/UKAMF. Bear in mind that the example given is one of the easy ones!

  1. The A-to-Z knowledgebase stores the basic resource URL; usually a link to the journal home page. In the kind of pseudo-markup tags used by the A-to-Z to rewrite URLs, this is identified as {URL}.
    • For example, the {URL} of the e- journal Food Science and Technology International is:
      • http://fst.sagepub.com/
  2. First we visit the journal home page at {URL} and hunt around until we track down a reliable Athens or WAYFless UK Federation login URL. Often we look at other libraries’ web pages and/or UKAMF guidelines for inspiration.
  3. Determine whether the login URL is indeed a predictable function of {URL}. If it isn’t; you might as well stop at this point!
    • E.g. (this one goes via Athens, and is predictable):
      • http://auth.athensams.net/?ath_dspid=SAGE&ath_returl=http%3A%2F%2Fonline.sagepub.com%2Flogin%3Furi%3Dhttp%253A%252F%252Ffst.sagepub.com%252F
  4. Often {URL} will need to be %-encoded one or more times (roughly; one level of encoding for each level of URL ‘nesting’: each time a parameter within the URL is itself another URL). Encoding can be expressed in the A-to-Z using the paired tags {startencode} and {endencode}. Now rewrite the login URL using A-to-Z markup tags:
    • E.g. (note the double encoding!):
      • http://auth.athensams.net/?ath_dspid=SAGE&ath_returl=http%3A%2F%2Fonline.sagepub.com%2Flogin%3Furi%3D{startencode}{startencode}{URL}{endencode}{endencode}
    • Or (equally valid):
      • http://auth.athensams.net/?ath_dspid=SAGE&ath_returl={startencode}http://online.sagepub.com/login?uri={startencode}{URL}{endencode}{endencode}
  5. Then, encode the whole login URL one more time, and prefix the whole thing with the standard Athens cookie-setting URL. This ensures that users are sent to the University of Lincoln ‘alternative login’ point, rather than the old-fashioned Athens username and password form.
    • Either:
      • http://auth.athensams.net/setorg.php?id=LINCUNI&ath_returl={startencode}http://auth.athensams.net/?ath_dspid=SAGE&ath_returl={startencode}http://online.sagepub.com/login?uri={startencode}{URL}{endencode}{endencode}{endencode}
    • Or:
      • http://auth.athensams.net/setorg.php?id=LINCUNI&ath_returl=http%3A%2F%2Fauth.athensams.net%2F%3Fath_dspid%3DSAGE%26ath_returl%3Dhttp%253A%252F%252Fonline.sagepub.com%252Flogin%253Furi%253D{startencode}{startencode}{startencode}{URL}{endencode}{endencode}{endencode}

It may look awful, but it works! (Usually.) It would be very useful if there were a place for A-to-Z customers to share (via a wiki, maybe) URL rewriting tips and examples. Some other useful links:

Tags: , , , , , , , , , , , ,

Leave a Reply