| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.commons.mail.DefaultAuthenticator |
|
|
| 1 | /* |
|
| 2 | * Copyright 2001-2005 The Apache Software Foundation |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at |
|
| 7 | * |
|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 | * |
|
| 10 | * Unless required by applicable law or agreed to in writing, software |
|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 | * See the License for the specific language governing permissions and |
|
| 14 | * limitations under the License. |
|
| 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 | 72 | { |
| 43 | 72 | this.authentication = new PasswordAuthentication(userName, password); |
| 44 | 72 | } |
| 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 | 96 | return this.authentication; |
| 57 | } |
|
| 58 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |