You can configure jUDDI to use one of the three Authentication modules supplied or you can write your own Authenticator that integrates jUDDI with your organizations authentication mechanism. All you have to do to create your own Authenticator is create a class that implements the org.apache.juddi.auth.Authenticator interface.

Below is an example of a custom Authenticator that successfully authenticates any user who specifies a password of steve.

	package net.viens.juddi.auth;

	import org.apache.juddi.auth.Authenticator;
	import org.apache.juddi.error.RegistryException;
	import org.apache.juddi.error.UnknownUserException;

	/**
	 * This is a sample implementation of jUDDI's Authenticator 
	 * interface.
	 */
	public class MyCoolAuthenticator implements Authenticator
	{
	  /**
	   *
	   */
	  public String authenticate(String userID,String credential)
	    throws RegistryException
	  {
	    if (credential.equals("steve"))
	      return userID;
	    else
	    throw new UnknownUserException("The userID specified is unknown.");
	  }
	}
  

IMPORTANT: If you take a look at the return value you'll notice that the userID parameter value passed in is being returned. This is important to do this becauase jUDDI uses this value as a key to fetch and maintain information about the account associated with the user.

Once you've created your Authenticator you'll need to place it in the webapps classpath. One common way to do this is to place it in the WEB-INF/classes directory (remember to place it in a directory structure that matches your package name). Also, make sure any classes or jar files that your authenticator is dependent on are accessable by the jUDDI web application (either in WEB-INF/classes, WEB-INF/lib).

Now you've got to instruct jUDDI to use your new authenticator. This is done by simply setting the juddi.auth property in jUDDI's property file ("juddi.properties") to the fully qualified class name of your Authenticator. The juddi.properties file is located in the WEB-INF directory. Take a quick glance through the juddi.properties file to be sure that the juddi.auth property isn't already set - if it is then either replace the class name with yours or remove/comment-out the line.

    juddi.auth = net.viens.juddi.auth.MyCoolAuthenticator
  

That's it. You will need to restart the jUDDI web application for this change to take effect.

Window size: x Viewport size: x

  • No labels