Problem:
- Product Name: BES
- Product Version: 6.x
- Product Component: Security Service
- Platform/OS Version: All
How to use customized CallbackHandler on client side?
For example, if I need to create a swing based application with a login dialog. This dialog will retrieve user/pwd. Once with this, client can be set to specify the Realm and interact with the CallbackHandler.
Resolution:
The customized CallbackHandler needs to inherit from javax.security.auth.callback.CallbackHandler and needs to implement the handle() method for how the user authentication information will be handled, for example:
package myapp.examples.client public class MyCallbackHandler implements javax.security.auth.callback.CallbackHandler {
... ...
public void handle ( Callback[] callbacks ) { ... ...
for (int i=0; i if (callbacks instanceof NameCallback) {
//prompt the user for username
...
}
else if (callbacks instanceof PasswordCallback) {
//prompt the user for password
...
}
... ...
}
}
}
It need to be in the classpath for the client. And the client needs to specify the following vbroker properties to specify the Realm and to this CallbackHandler class,
vbroker.security.disable=false
vbroker.security.login=true
vbroker.security.login.realms=
vbroker.security.authentication.callbackHandler=myapp.examples.client.MyCallbackHandler
The way for the client to specify the properties is up to you. If you run appclient, you can specify the CallbackHandler class in your client jar's deployment descriptor. If you use "vbj" or "java", the properties can be passed in as runtime parameters, or set as java system properties in the client application.
#Security
#VisiBroker