01: /*
02: * Modified by Nabh Information Systems, Inc.
03: * Modifications (c) 2006 Nabh Information Systems, Inc.
04: *
05: * Copyright 2001-2005 The Apache Software Foundation
06: *
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19: package com.nabhinc.util;
20:
21: import javax.mail.Authenticator;
22: import javax.mail.PasswordAuthentication;
23:
24: /**
25: * This is a very simple authentication object that can be used for any
26: * transport needing basic userName and password type authentication.
27: *
28: * @since 1.0
29: * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
30: * @version $Id: DefaultMailAuthenticator.java,v 1.1 2006/11/11 04:56:45 wchokry Exp $
31: */
32: public class DefaultMailAuthenticator extends Authenticator {
33: /** Stores the login information for authentication */
34: private PasswordAuthentication authentication;
35:
36: /**
37: * Default constructor
38: *
39: * @param userName user name to use when authentication is requested
40: * @param password password to use when authentication is requested
41: * @since 1.0
42: */
43: public DefaultMailAuthenticator(String userName, String password) {
44: this .authentication = new PasswordAuthentication(userName,
45: password);
46: }
47:
48: /**
49: * Gets the authentication object that will be used to login to the mail
50: * server.
51: *
52: * @return A <code>PasswordAuthentication</code> object containing the
53: * login information.
54: * @since 1.0
55: */
56: protected PasswordAuthentication getPasswordAuthentication() {
57: return this.authentication;
58: }
59: }
|