2
|
1 |
/*
|
|
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 |
|
|
26 |
package sun.net.www.protocol.http;
|
|
27 |
|
|
28 |
import java.io.IOException;
|
|
29 |
import java.net.URL;
|
|
30 |
import java.util.Hashtable;
|
|
31 |
import java.util.LinkedList;
|
|
32 |
import java.util.ListIterator;
|
|
33 |
import java.util.Enumeration;
|
|
34 |
import java.util.HashMap;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* @author Michael McMahon
|
|
38 |
*
|
|
39 |
* Interface provided by internal http authentication cache.
|
|
40 |
* NB. This API will be replaced in a future release, and should
|
|
41 |
* not be made public.
|
|
42 |
*/
|
|
43 |
|
|
44 |
public interface AuthCache {
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Put an entry in the cache. pkey is a string specified as follows:
|
|
48 |
*
|
|
49 |
* A:[B:]C:D:E[:F] Between 4 and 6 fields separated by ":"
|
|
50 |
* where the fields have the following meaning:
|
|
51 |
* A is "s" or "p" for server or proxy authentication respectively
|
|
52 |
* B is optional and is "D", "B", or "N" for digest, basic or ntlm auth.
|
|
53 |
* C is either "http" or "https"
|
|
54 |
* D is the hostname
|
|
55 |
* E is the port number
|
|
56 |
* F is optional and if present is the realm
|
|
57 |
*
|
|
58 |
* Generally, two entries are created for each AuthCacheValue,
|
|
59 |
* one including the realm and one without the realm.
|
|
60 |
* Also, for some schemes (digest) multiple entries may be created
|
|
61 |
* with the same pkey, but with a different path value in
|
|
62 |
* the AuthCacheValue.
|
|
63 |
*/
|
|
64 |
public void put (String pkey, AuthCacheValue value);
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Get an entry from the cache based on pkey as described above, but also
|
|
68 |
* using a pathname (skey) and the cache must return an entry
|
|
69 |
* if skey is a sub-path of the AuthCacheValue.path field.
|
|
70 |
*/
|
|
71 |
public AuthCacheValue get (String pkey, String skey);
|
|
72 |
|
|
73 |
/**
|
|
74 |
* remove the entry from the cache whose pkey is specified and
|
|
75 |
* whose path is equal to entry.path. If entry is null then
|
|
76 |
* all entries with the same pkey should be removed.
|
|
77 |
*/
|
|
78 |
public void remove (String pkey, AuthCacheValue entry);
|
|
79 |
}
|