Novell Home

Simplifying LDAP Logins

Novell Cool Solutions: Trench
By Rob Bennett

Digg This - Slashdot This

Posted: 20 Feb 2003
 

The Problem:
iChain is a winning tool. We use it to provide our users access to their GroupWise webmail, our Intranet and a number of other business systems. We've never installed a single product that has solved so many problems all at once. Dial-up is dead -- long live iChain!

Mind you, it comes with one big problem. As we were installing, configuring and testing it, the feedback we were getting was that typing your login in LDAP format was going to be just too hard. We needed the name to be fully qualified, but with all those ou='s and commas it was way too difficult.

The Solution:
I wrote the following javascript which converts a user-supplied "traditional" username.context format login to the LDAP cn=username,ou=department,o=company format in the background. The "username" field which iChain reads is then set to hidden. The code is activated by onChange="keypress()" in the loginid field, which provides a rather nice side-benefit: the onChange action isn't triggered when the browser form-fills the fields for the user. Using, onChange, keeps the users from getting get the error "missing some fields" when the page loads.

This solution has also helped us train our users to not leave their login credentials where others may find them!

<SCRIPT LANGUAGE = "JavaScript">

function keypress()
  {
  var loginstr=document.form1.loginid.value
  var loginarray=loginstr.split(".")
  newstring = new String("")

  for (var i=0; i < loginarray.length; i++)
    {
    if(i==0)
      {newstring += "cn=" + loginarray[i]}
    else
     {
      if(i==loginarray.length-1)
        {newstring += ",o=" + loginarray[i] }
      else
        {newstring += ",ou=" + loginarray[i] }
      }
    }
  document.form1.username.value = newstring
  }
</SCRIPT>

This assumes that you've dropped the Novell-supplied html files and have composed your own, but I'm sure there would be nothing to stop you putting this script into the standard one.

If you have questions or kudos for Rob, you can e-mail him at rob_bennettTAKETHISOUT@mcga.gov.uk


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell