01: /*
02: * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * 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:
26: package sun.net.www.protocol.http;
27:
28: import java.io.IOException;
29: import java.io.Serializable;
30: import java.net.*;
31: import java.util.Hashtable;
32: import java.util.LinkedList;
33: import java.util.ListIterator;
34: import java.util.Enumeration;
35: import java.util.HashMap;
36:
37: /**
38: * AuthCacheValue: interface to minimise exposure to authentication cache
39: * for external users (ie. plugin)
40: *
41: * @author Michael McMahon
42: * @version 1.1, 10/02/03
43: */
44:
45: public abstract class AuthCacheValue implements Serializable {
46:
47: public enum Type {
48: Proxy, Server
49: };
50:
51: /**
52: * Caches authentication info entered by user. See cacheKey()
53: */
54: static protected AuthCache cache = new AuthCacheImpl();
55:
56: public static void setAuthCache(AuthCache map) {
57: cache = map;
58: }
59:
60: /* Package private ctor to prevent extension outside package */
61:
62: AuthCacheValue() {
63: }
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: }
|