Hi,
I'm trying to authenticate the users with the predefined username and password. For this we need AuthenticationHandler, AFAIK, and using this we can fetch the username and password from the validator but when I do this, I get an connection timeout problem as soon as the call is made although i set the connection timeout relatively big.
public class EmailRelayServer {
public static void main(String[] args) {
MyMessageHandlerFactory myFactory = new MyMessageHandlerFactory();
UsernamePasswordValidator validator = new RequiredUsernamePasswordValidator();
EasyAuthenticationHandlerFactory fact = new EasyAuthenticationHandlerFactory(validator);
SMTPServer smtpServer = new SMTPServer(myFactory);
smtpServer.setPort(25000);
smtpServer.setAuthenticationHandlerFactory(fact);
smtpServer.setConnectionTimeout(50000);
smtpServer.start();
}
}
class RequiredUsernamePasswordValidator implements UsernamePasswordValidator {
String REQUIRED_USERNAME = "admin1";
String REQUIRED_PASSWORD = "password";
public void login(String username, String password) throws LoginFailedException {
if (!username.equals(REQUIRED_USERNAME) || !password.equals(REQUIRED_PASSWORD)) {
throw new LoginFailedException();
}
}
}
I use the above logic, however as soon as I hit on the send email button, I am asked for a password, not even for a username? and i write the password as "password" and hit on it. Then I just get the error saying that "connection timeout occurered".
If someone has experience with this library, could you pls enlighten me in this sense for the authentication with the username and the pw. Thanks in advance..
Hi, I'm trying to authenticate the users with the predefined username and password. For this we need AuthenticationHandler, AFAIK, and using this we can fetch the username and password from the validator but when I do this, I get an connection timeout problem as soon as the call is made although i set the connection timeout relatively big.
I use the above logic, however as soon as I hit on the send email button, I am asked for a password, not even for a username? and i write the password as "password" and hit on it. Then I just get the error saying that "connection timeout occurered".
If someone has experience with this library, could you pls enlighten me in this sense for the authentication with the username and the pw. Thanks in advance..