KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > util > EMailAuthenticator


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.util;
15
16 import javax.mail.*;
17 import java.net.InetAddress JavaDoc;
18
19 /**
20  * Email User Authentification
21  *
22  * @author Jorg Janke
23  * @version $Id: EMailAuthenticator.java,v 1.2 2003/06/20 14:32:34 jjanke Exp $
24  */

25 public class EMailAuthenticator extends Authenticator
26 {
27     /**
28      * Constructor
29      * @param username user name
30      * @param password user password
31      */

32     public EMailAuthenticator (String JavaDoc username, String JavaDoc password)
33     {
34         m_pass = new PasswordAuthentication (username, password);
35         if (username == null || username.length() == 0)
36         {
37             System.err.println("EMailAuthenticator - Username is NULL");
38             Thread.dumpStack();
39         }
40         if (password == null || password.length() == 0)
41         {
42             System.err.println("EMailAuthenticator - Password is NULL");
43             Thread.dumpStack();
44         }
45     } // EMailAuthenticator
46

47     /** Password */
48     private PasswordAuthentication m_pass;
49
50     /**
51      * Ger PasswordAuthentication
52      * @return Password Autnetifucation
53      */

54     protected PasswordAuthentication getPasswordAuthentication()
55     {
56         return m_pass;
57     } // getPasswordAuthentication
58

59     /**
60      * Get String representation
61      * @return info
62      */

63     public String JavaDoc toString()
64     {
65         if (m_pass == null)
66             return "EMailAuthenticator[]";
67         return "EMailAuthenticator[" + m_pass.getUserName() + "/" + m_pass.getPassword() + "]";
68     } // toString
69

70 } // EMailAuthenticator
Popular Tags