1/*
2 * Copyright (c) 2003, Oracle and/or its affiliates. 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.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package sun.net.www.protocol.http;
27
28/**
29 * @author Michael McMahon
30 *
31 * Interface provided by internal http authentication cache.
32 * NB. This API will be replaced in a future release, and should
33 * not be made public.
34 */
35
36public interface AuthCache {
37
38    /**
39     * Put an entry in the cache. pkey is a string specified as follows:
40     *
41     * A:[B:]C:D:E[:F][;key=value]   Between 4 and 6 fields separated by ":",
42     *          and an optional semicolon-separated key=value list postfix,
43     *          where the fields have the following meaning:
44     * A is "s" or "p" for server or proxy authentication respectively
45     * B is optional and is the {@link AuthScheme}, e.g. BASIC, DIGEST, NTLM, etc
46     * C is either "http" or "https"
47     * D is the hostname
48     * E is the port number
49     * F is optional and if present is the realm
50     *
51     * The semi-colon separated key=value list postfix can be used to
52     * provide additional contextual information, thus allowing
53     * to separate AuthCacheValue instances obtained from different
54     * contexts.
55     *
56     * Generally, two entries are created for each AuthCacheValue,
57     * one including the realm and one without the realm.
58     * Also, for some schemes (digest) multiple entries may be created
59     * with the same pkey, but with a different path value in
60     * the AuthCacheValue.
61     */
62    public void put (String pkey, AuthCacheValue value);
63
64    /**
65     * Get an entry from the cache based on pkey as described above, but also
66     * using a pathname (skey) and the cache must return an entry
67     * if skey is a sub-path of the AuthCacheValue.path field.
68     */
69    public AuthCacheValue get (String pkey, String skey);
70
71    /**
72     * remove the entry from the cache whose pkey is specified and
73     * whose path is equal to entry.path. If entry is null then
74     * all entries with the same pkey should be removed.
75     */
76    public void remove (String pkey, AuthCacheValue entry);
77}
78