How to get login password in servlets

Posted by Dusk on Stack Overflow See other posts from Stack Overflow or by Dusk
Published on 2010-03-31T19:33:48Z Indexed on 2010/03/31 20:13 UTC
Read the original article Hit count: 295

Filed under:
|
|

I've successfully implemented form based authentication, and now I want to get the username and password to initialize session object in javamail from servlets. How can I do that? I can getlogin username by using method request.getRemoteUser(), but I don't know how to get the password.

If I create any session object like:

authentication = new PasswordAuthentication(user,password);
Properties props = new Properties();
props.put("mail.host", "localhost");
props.put("mail.debug",true);
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp"); 
Session session = Session.getInstance(props, this);

then how can I get inbox messages from mail server based upon particular username and password, if I don't pass any password from servlets to PasswordAuthentication object?

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets