KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > weblech > spider > DumbAuthenticator


1 /*
2  * This is the MIT license, see also http://www.opensource.org/licenses/mit-license.html
3  *
4  * Copyright (c) 2001 Brian Pitcher
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */

24
25 // $Header: /cvsroot/weblech/weblech/src/weblech/spider/DumbAuthenticator.java,v 1.1 2001/10/21 16:36:44 weblech Exp $
26

27 package weblech.spider;
28
29 import org.apache.log4j.Category;
30
31 import java.net.Authenticator JavaDoc;
32 import java.net.PasswordAuthentication JavaDoc;
33
34 import weblech.util.Log4j;
35
36 public class DumbAuthenticator extends Authenticator JavaDoc
37 {
38     private final static Category _logClass = Category.getInstance(DumbAuthenticator.class);
39
40     static
41     {
42         Log4j.init();
43     }
44
45     private final String JavaDoc user;
46     private final String JavaDoc password;
47
48     public DumbAuthenticator(String JavaDoc user, String JavaDoc password)
49     {
50         _logClass.debug("DumbAuthenticator(" + user + ", ***)");
51         this.user = user;
52         this.password = password;
53     }
54
55     public PasswordAuthentication JavaDoc getPasswordAuthentication()
56     {
57         _logClass.debug("getPasswordAuthentication()");
58         return new PasswordAuthentication JavaDoc(user, password.toCharArray());
59     }
60 }
61
Popular Tags