I run into problem with login screen in netbeans rcp.
server side : glassfish v 3.1 , ejb and HessianServlet with basic auth in web.xml
client side : netebeans rcp 7.0 and server side Api.
on the server used custom realm and client provides UserName and Password after splash screen, in custom login panel runing on top of DialogDescriptor
login panel code:
public class Installer extends ModuleInstall {
...
@Override
public void restored() {
DialogDescriptor loginDialog = new DialogDescriptor(panel, "Login Dialog");
loginDialog.setModal(true);
loginDialog.setClosingOptions(new Object[]{});
loginDialog.setOptions(new Object[]{});
loginDialog.setButtonListener(al);
loginDialog.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (NotifyDescriptor.CLOSED_OPTION.equals(evt.getNewValue())) {
LifecycleManager.getDefault().exit();
}
}
});
DialogDisplayer.getDefault().notifyLater(loginDialog);
...
}
this login panel simply invokes one secured method on server side and if exception do not happend and returned String[] contains user Name and Surname, then login screen disposes and rcp shown to client.
in login panel :
HessianProxyFactory proxy= new HessianProxyFactory();
proxy.setUser(user);
proxy.setPassword(password);
LoginObject loginObject = xxx.create(LoginObject .class, "<a href="http://localhost:port/trali/vali">http://localhost:port/trali/vali");
String[] value=loginObject .isAppUser("login name");
if(value==null){
//message login failed
}else {
//dispose login screen and show main app
}
everything is OK till client provides correct user name and password, but if login faild on server Netbeans RCP pop ups Authentication Requires Dialog like in web browser basic auth dialog.
How to disable this dialog?
thanks in advance!
You can override this dialog with the method Authenticator.setDefault(Authenticator).
If you do attempt to disable the authentication, by overriding the default authenticator, you will need to take that into consideration in your client code... since you may get a stream of 'Unauthorized' responses.