private void registerAuthenticator( final String user, final String password )
{
if ( user == null || password == null )
{
return;
}
final Authenticator authenticator = new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication( user, password.toCharArray() );
}
};
// not exactly pretty but this is how org.eclipse.core.net does it
Authenticator.setDefault( authenticator );
}