1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.mail;
17
18 import javax.mail.Authenticator;
19 import javax.mail.PasswordAuthentication;
20
21 /***
22 * This is a very simple authentication object that can be used for any
23 * transport needing basic userName and password type authentication.
24 *
25 * @since 1.0
26 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
27 * @version $Id: DefaultAuthenticator.java 225600 2005-07-27 20:16:23Z rdonkin $
28 */
29 public class DefaultAuthenticator extends Authenticator
30 {
31 /*** Stores the login information for authentication */
32 private PasswordAuthentication authentication;
33
34 /***
35 * Default constructor
36 *
37 * @param userName user name to use when authentication is requested
38 * @param password password to use when authentication is requested
39 * @since 1.0
40 */
41 public DefaultAuthenticator(String userName, String password)
42 {
43 this.authentication = new PasswordAuthentication(userName, password);
44 }
45
46 /***
47 * Gets the authentication object that will be used to login to the mail
48 * server.
49 *
50 * @return A <code>PasswordAuthentication</code> object containing the
51 * login information.
52 * @since 1.0
53 */
54 protected PasswordAuthentication getPasswordAuthentication()
55 {
56 return this.authentication;
57 }
58 }