|
This app provides a simple example of login authentication using Netscape's LDAP
Java API.
The example contains one AppLogic, Login.java (plus the standard base classes Session and BaseAppLogic),
and two HTML files: LDAPLogin.html and wrongLogin.html.
The login page, LDAPLogin.html, lets the user enter a user name and password,
which are used to authenticate the user on the LDAP server.
If successful, the user's LDAP attributes are streamed out to the client.
(In a real app, this would probably call a method to extract a user ID or role to save to the session,
and then call another App Logic that goes into the application itself.)
If the login is not successful, then the user is redirected to wrongLogin.html and allowed to try again,
up to a maximum number of failures, after which
all login attempts will be refused, until the user's session expires.
In addition to the standard execute() and guid() method, the Login AppLogic contains the following methods:
- maxFailuresReached: determines if the user's maximum number of failed logins has been reached.
- getDN: gets the LDAP distinguished name for the specified user
- authenticateUser: attempts to authenticate the user with the specified password on the specified
LDAP server.
To get this example working you need to do the following:
- Put the LDAP JAR file, LDAPJDK.JAR, on your NAS machine, and add it to your system
CLASSPATH.
- Because Java classes with native methods must be loaded by the default
Java VM classloader, aka the 'primordial' classloader, instead of the
KIVA classloader, you must edit a filter list in the registry. Start up kreg
tool (Regedit on NT: HKEY_LOCAL_MACHINE).
Navigate in the tree to the following key...
SOFTWARE/KIVA/Enterprise/2.0/CCS0/SYSTEM_JAVA
Edit the GX_CLASSPATH_CORE value. It's default installed value
should be...
java.;gx.;com.kivasoft.
Add "netscape." so that it now looks like:
java.;gx.;com.kivasoft.;netscape.
- Then restart your Netscape Application Server.
Download the example source
Release Notes
For Solaris, make sure to compile on the deployed server to ensure all necessary classes are included in the CLASSPATH.
|