Skip to main content

Using narrow() method for Naming Service with security enabled

  • February 16, 2013
  • 0 replies
  • 0 views

Problem:

  • Product Name: VisiBroker Java
  • Product Version: 6.5 and later
  • Product Component: Security/Naming Service
  • Platform/OS Version: all

How to use narrow() method for VisiBroker Naming Service with security enabled? Although unchecked_narrow() works fine, but it disables remote _is_a() call during the narrow().

How to implement your own custom callback handler so that you do not need to enter user/name password manually?

Resolution:

The following steps/solution helps you to set username and password programmatically and use narrow() method successfully with security enabled:

(1) Please follow the instruction from readme.txt file from bank_naming_all.zip example and create all the necessary property files.

(2) Now to set username and password programmatically. We will need to customize callbackHandler. For example, we have developed one sample callbackHandler and the detailed steps are here (Note: you can also refer to some other documentation on how to customize own callbackHandler, e.g. from JDK API documentation for CallbackHandler). 

(a) Develop a customize callbackhandler class of com.borland.security.provider.authn.HostCallbackHandler2.

Check the attached source of HostCallbackHandler2.java. This callbackHandler mainly makes use of the functions provided by com.borland.security.provider.authn.CmdLineCallbackHandler for simplicity.

In this simple callbackHandler, we just hard coded the username and password (both are "admin").

(b) Set VisiBroker environment and then use vbjc to compile this class of HostCallbackHandler2. Use jar to package this class into some jar file (such as "myhandler.jar"). Make a directory of $VBROKERDIR/lib/patches and copy this "myhandler.jar" into $VBROKERDIR/lib/patches. Otherwise just make this jar file available in the current CLASSPATH environment variable.

(c) Modify the "naming_client.props" created in step 1.

change

vbroker.security.authentication.callbackHandler=com.borland.security.provider.authn.HostCallbackHandler

to

vbroker.security.authentication.callbackHandler=com.borland.security.provider.authn.HostCallbackHandler2

(3) Follow the instruction in step 1 to run nameserv, server and client. Now you does not need to manually enter username and password.

With this solution, you can implement more complex authentication methods by writing your own callbackhandler.

 


#VisiBroker
#callbackhandler
#NamingService
#Security