I
have had several requests for help with authenticating a user with a
web form using their EUID and password. The following is a library
that I have written that does just that. As you can see from the
example below it takes four fields using a POST method to
https://osprey.unt.edu/cwslib/authldap.php . The euid field and
password field is what the user will enter while the Succeed Redirect
URL and Failed Redirect URL can be hidden fields. The way this works
is as follows. Create a form using the following code:
< FORM ACTION= https://osprey.unt.edu/cwslib/authldap.php METHOD=
POST>
< TABLE>
< TR> < TD>euid:</ TD>< TD>< INPUT TYPE= text NAME=
uid></ TD></ TR>
< TR>< TD>Password:</ TD>< TD>< INPUT TYPE= password NAME= passwd></
TD></ TR>
< INPUT TYPE= HIDDEN NAME= SuceedRedirect>
< INPUT TYPE= HIDDEN NAME= FailedRedirect>
< TR>< TD>< INPUT TYPE= submit NAME= submit VALUE= "Login"></ TD>
< TD>< INPUT TYPE= reset NAME= reset VALUE= "Clear Form"></ TD> </ TR>
</ TABLE>
</ FORM>
What this does is require the user to enter his/her EUID and
Password. The field SuceedRedirect is the URL that you want to
automatically redirect the user to on a successful login. The field
FailedRedirect is the URL that you want to automatically redirect the
user to if the login failed. This script takes the supplied uid and
password and tries to bind to the LDAP server. If you leave the
SuceedRedirect and FailedRedirect fields blank you will get the
following:
Bind failed (Not Logged In)
Username and Password did not match.
or
Bind succeeded (Logged In)
Depending on whether the login was successful or not. If you call
https://osprey.unt.edu/cwslib/authldap.php without either uid or
passwd fields you will get the following:
If you have any questions or suggestions for other libraries that
would be useful for other developers around campus just drop me an
email at jpwilliams@unt.edu.