import java.net.Authenticator; import java.net.PasswordAuthentication; // ... /** * Minimalist custom Authenticator to provide userid/password * to Java protocols. */ class MyAuthenticator extends Authenticator { /** * Called when password authorization is needed. * @return The PasswordAuthentication collected from the * user, or null if none is provided. */ protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ( "Alladin", "sesame".toCharArray() ); } }