/** * Returns email store. * * @param session {@link Session} * @return {@link com.sun.mail.imap.IMAPSSLStore} */ @Override protected IMAPSSLStore getStore(final Session session) { SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator; final URLName url; if (simpleAuthenticator == null) { url = new URLName( PROTOCOL_IMAP, host, port, StringPool.EMPTY, null, null); } else { final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication(); url = new URLName( PROTOCOL_IMAP, host, port, StringPool.EMPTY, pa.getUserName(), pa.getPassword()); } return new IMAPSSLStore(session, url); }
/** * Returns email store. * * @param session {@link Session} * @return {@link com.sun.mail.pop3.POP3SSLStore} */ @Override protected POP3SSLStore getStore(final Session session) { final SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator; final URLName url; if (simpleAuthenticator == null) { url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, null, null); } else { final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication(); url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, pa.getUserName(), pa.getPassword()); } return new POP3SSLStore(session, url); }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
if (user == null) { user = pw.getUserName(); password = pw.getPassword(); } else if (user.equals(pw.getUserName())) { password = pw.getPassword(); if (pw != null) { user = pw.getUserName(); password = pw.getPassword();
if (user == null) { user = pw.getUserName(); password = pw.getPassword(); } else if (user.equals(pw.getUserName())) { password = pw.getPassword(); if (pw != null) { user = pw.getUserName(); password = pw.getPassword();
private void refreshPassword() { if (debug) out.println("DEBUG: refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
private void refreshPassword() { if (logger.isLoggable(Level.FINE)) logger.fine("refresh password, user: " + traceUser(user)); InetAddress addr; try { addr = InetAddress.getByName(host); } catch (UnknownHostException e) { addr = null; } PasswordAuthentication pa = session.requestPasswordAuthentication(addr, port, name, null, user); if (pa != null) { user = pa.getUserName(); password = pa.getPassword(); } }
if (pa != null) { user = pa.getUserName(); password = pa.getPassword();
/** * Returns email store. * * @param session {@link Session} * @return {@link com.sun.mail.pop3.POP3SSLStore} */ @Override protected POP3SSLStore getStore(final Session session) { final SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator; final URLName url; if (simpleAuthenticator == null) { url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, null, null); } else { final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication(); url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, pa.getUserName(), pa.getPassword()); } return new POP3SSLStore(session, url); }
/** * Returns email store. * * @param session {@link Session} * @return {@link com.sun.mail.imap.IMAPSSLStore} */ @Override protected IMAPSSLStore getStore(final Session session) { SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator; final URLName url; if (simpleAuthenticator == null) { url = new URLName( PROTOCOL_IMAP, host, port, StringPool.EMPTY, null, null); } else { final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication(); url = new URLName( PROTOCOL_IMAP, host, port, StringPool.EMPTY, pa.getUserName(), pa.getPassword()); } return new IMAPSSLStore(session, url); }
Credentials credentials = new SimpleCredentials(auth.getUserName(), auth.getPassword().toCharArray()); session = repository.login(credentials);
if (user == null) { user = pw.getUserName(); password = pw.getPassword(); } else if (user.equals(pw.getUserName())) { password = pw.getPassword(); if (pw != null) { user = pw.getUserName(); password = pw.getPassword();
if (user == null) { user = pw.getUserName(); password = pw.getPassword(); } else if (user.equals(pw.getUserName())) { password = pw.getPassword(); if (pw != null) { user = pw.getUserName(); password = pw.getPassword();
@Test public void testDefaultAuthenticatorConstructor() { //insert code testing basic functionality final String strUsername = "user.name"; final String strPassword = "user.pwd"; final DefaultAuthenticator authenticator = new DefaultAuthenticator(strUsername, strPassword); assertTrue( PasswordAuthentication.class.isInstance( authenticator.getPasswordAuthentication())); assertEquals( strUsername, authenticator.getPasswordAuthentication().getUserName()); assertEquals( strPassword, authenticator.getPasswordAuthentication().getPassword()); }
@Test public void testGetSetAuthentication() { // setup final String strUsername = "user.name"; final String strPassword = "user.pwd"; email.setAuthentication(strUsername, strPassword); // this is cast into DefaultAuthenticator for convenience // and give us access to the getPasswordAuthentication fn final DefaultAuthenticator retrievedAuth = (DefaultAuthenticator) email.getAuthenticator(); // tests assertEquals( strUsername, retrievedAuth.getPasswordAuthentication().getUserName()); assertEquals( strPassword, retrievedAuth.getPasswordAuthentication().getPassword()); }
@Test public void testGetSetAuthenticator() { // setup final String strUsername = "user.name"; final String strPassword = "user.pwd"; final DefaultAuthenticator authenticator = new DefaultAuthenticator(strUsername, strPassword); email.setAuthenticator(authenticator); // this is cast into DefaultAuthenticator for convenience // and give us access to the getPasswordAuthentication fn final DefaultAuthenticator retrievedAuth = (DefaultAuthenticator) email.getAuthenticator(); // tests assertEquals( strUsername, retrievedAuth.getPasswordAuthentication().getUserName()); assertEquals( strPassword, retrievedAuth.getPasswordAuthentication().getPassword()); }