Next Topic

Previous Topic

Book Contents

Authentication Plugin Java Class

If you want to create a java class for authentication, your plugin class must implement the NetvigilPluginAuthentication interface. See the javadoc for NetvigilPluginAuthentication for more information.

Your implementation of the Java class NetvigilPluginAuthentication.getAuthenticationString should take the user login name and password, and create an authentication string, such as an encrypted password, from this information. The Properties argument to getAuthenticationString is reserved for future use. When a user logs in, your implementation of NetVigilPluginAuthentication.authenticate is given the user login name, the authentication string for that user that was created by getAuthenticationString, and the password the user gave when he or she tried to log in. As with getAuthenticationString, the Properties parameter to authenticate is reserved for future use. Your version of authenticate should use this information to determine whether or not the user should be allowed to log in. If the user should be allowed to login, your version of authenticate should return true.

As an example, for a Java class which does authentication using rot13 to encrypt a given password, you should choose a unique string to identify the authentication method for your class. This string will be stored in the database to indicate the type of authentication method to use with a given authentication string. The strings clear, des, and script are reserved, but you can use any other unique string to identify your plugin authentication method.
Finally, you must use the unique string along with the name of your plugin class in the authentication section of $TRAVERSE_HOME/etc/emerald.xml to identify your plugin class as the class to use for authentication. For example, if you wanted to use the rot13 class mentioned above for authentication, you could choose the string rot13 as the identifier, and modify the authentication section in emerald.xml so that it looks like this:

<authentication
 method="rot13"
 class="[Rot13Authentication]"
 execute=""
 parameters=""
/>

Leave the execute and parameters attributes in the authentication section empty. They're reserved for plugin authentication using scripts described in Authentication Plugin Script.

Once you're done writing your class, create a *.jar file for it and any other required classes and place them in $TRAVERSE_DIR/plugin/auth directory. Your plugin class, and any third party *.jars you've included, must work under Sun JRE 1.5.