blob: 539d483b2e41ee9c5123e4067d1065a8c74b94a4 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package sun.net.www.protocol.http;
27
28import java.io.IOException;
29import java.io.Serializable;
30import java.net.*;
31import java.util.Hashtable;
32import java.util.LinkedList;
33import java.util.ListIterator;
34import java.util.Enumeration;
35import java.util.HashMap;
36
37
38/**
39 * AuthCacheValue: interface to minimise exposure to authentication cache
40 * for external users (ie. plugin)
41 *
42 * @author Michael McMahon
43 */
44
45public abstract class AuthCacheValue implements Serializable {
46
47 public enum Type {
48 Proxy,
49 Server
50 };
51
52 /**
53 * Caches authentication info entered by user. See cacheKey()
54 */
55 static protected AuthCache cache = new AuthCacheImpl();
56
57 public static void setAuthCache (AuthCache map) {
58 cache = map;
59 }
60
61 /* Package private ctor to prevent extension outside package */
62
63 AuthCacheValue() {}
64
65 abstract Type getAuthType ();
66
67 /**
68 * name of server/proxy
69 */
70 abstract String getHost ();
71
72 /**
73 * portnumber of server/proxy
74 */
75 abstract int getPort();
76
77 /**
78 * realm of authentication if known
79 */
80 abstract String getRealm();
81
82 /**
83 * root path of realm or the request path if the root
84 * is not known yet.
85 */
86 abstract String getPath();
87
88 /**
89 * returns http or https
90 */
91 abstract String getProtocolScheme();
92
93 /**
94 * the credentials associated with this authentication
95 */
96 abstract PasswordAuthentication credentials();
97}