xref: /aosp_15_r20/external/cronet/net/http/http_auth_cache.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker // Copyright 2011 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker 
5*6777b538SAndroid Build Coastguard Worker #ifndef NET_HTTP_HTTP_AUTH_CACHE_H_
6*6777b538SAndroid Build Coastguard Worker #define NET_HTTP_HTTP_AUTH_CACHE_H_
7*6777b538SAndroid Build Coastguard Worker 
8*6777b538SAndroid Build Coastguard Worker #include <stddef.h>
9*6777b538SAndroid Build Coastguard Worker 
10*6777b538SAndroid Build Coastguard Worker #include <list>
11*6777b538SAndroid Build Coastguard Worker #include <map>
12*6777b538SAndroid Build Coastguard Worker #include <string>
13*6777b538SAndroid Build Coastguard Worker 
14*6777b538SAndroid Build Coastguard Worker #include "base/functional/callback.h"
15*6777b538SAndroid Build Coastguard Worker #include "base/gtest_prod_util.h"
16*6777b538SAndroid Build Coastguard Worker #include "base/memory/raw_ptr.h"
17*6777b538SAndroid Build Coastguard Worker #include "base/time/default_clock.h"
18*6777b538SAndroid Build Coastguard Worker #include "base/time/default_tick_clock.h"
19*6777b538SAndroid Build Coastguard Worker #include "base/time/time.h"
20*6777b538SAndroid Build Coastguard Worker #include "net/base/net_export.h"
21*6777b538SAndroid Build Coastguard Worker #include "net/base/network_anonymization_key.h"
22*6777b538SAndroid Build Coastguard Worker #include "net/http/http_auth.h"
23*6777b538SAndroid Build Coastguard Worker #include "url/scheme_host_port.h"
24*6777b538SAndroid Build Coastguard Worker 
25*6777b538SAndroid Build Coastguard Worker namespace net {
26*6777b538SAndroid Build Coastguard Worker 
27*6777b538SAndroid Build Coastguard Worker // HttpAuthCache stores HTTP authentication identities and challenge info.
28*6777b538SAndroid Build Coastguard Worker // For each (scheme_host_port, realm, scheme) triple the cache stores a
29*6777b538SAndroid Build Coastguard Worker // HttpAuthCache::Entry, which holds:
30*6777b538SAndroid Build Coastguard Worker //   - the origin server {protocol scheme, host, port}
31*6777b538SAndroid Build Coastguard Worker //   - the last identity used (username/password)
32*6777b538SAndroid Build Coastguard Worker //   - the last auth handler used (contains realm and authentication scheme)
33*6777b538SAndroid Build Coastguard Worker //   - the list of paths which used this realm
34*6777b538SAndroid Build Coastguard Worker // Entries can be looked up by either (origin, realm, scheme) or (origin, path).
35*6777b538SAndroid Build Coastguard Worker class NET_EXPORT HttpAuthCache {
36*6777b538SAndroid Build Coastguard Worker  public:
37*6777b538SAndroid Build Coastguard Worker   class NET_EXPORT Entry {
38*6777b538SAndroid Build Coastguard Worker    public:
39*6777b538SAndroid Build Coastguard Worker     Entry(const Entry& other);
40*6777b538SAndroid Build Coastguard Worker     ~Entry();
41*6777b538SAndroid Build Coastguard Worker 
scheme_host_port()42*6777b538SAndroid Build Coastguard Worker     const url::SchemeHostPort& scheme_host_port() const {
43*6777b538SAndroid Build Coastguard Worker       return scheme_host_port_;
44*6777b538SAndroid Build Coastguard Worker     }
45*6777b538SAndroid Build Coastguard Worker 
46*6777b538SAndroid Build Coastguard Worker     // The case-sensitive realm string of the challenge.
realm()47*6777b538SAndroid Build Coastguard Worker     const std::string& realm() const { return realm_; }
48*6777b538SAndroid Build Coastguard Worker 
49*6777b538SAndroid Build Coastguard Worker     // The authentication scheme of the challenge.
scheme()50*6777b538SAndroid Build Coastguard Worker     HttpAuth::Scheme scheme() const {
51*6777b538SAndroid Build Coastguard Worker       return scheme_;
52*6777b538SAndroid Build Coastguard Worker     }
53*6777b538SAndroid Build Coastguard Worker 
54*6777b538SAndroid Build Coastguard Worker     // The authentication challenge.
auth_challenge()55*6777b538SAndroid Build Coastguard Worker     const std::string& auth_challenge() const { return auth_challenge_; }
56*6777b538SAndroid Build Coastguard Worker 
57*6777b538SAndroid Build Coastguard Worker     // The login credentials.
credentials()58*6777b538SAndroid Build Coastguard Worker     const AuthCredentials& credentials() const {
59*6777b538SAndroid Build Coastguard Worker       return credentials_;
60*6777b538SAndroid Build Coastguard Worker     }
61*6777b538SAndroid Build Coastguard Worker 
IncrementNonceCount()62*6777b538SAndroid Build Coastguard Worker     int IncrementNonceCount() {
63*6777b538SAndroid Build Coastguard Worker       return ++nonce_count_;
64*6777b538SAndroid Build Coastguard Worker     }
65*6777b538SAndroid Build Coastguard Worker 
66*6777b538SAndroid Build Coastguard Worker     void UpdateStaleChallenge(const std::string& auth_challenge);
67*6777b538SAndroid Build Coastguard Worker 
68*6777b538SAndroid Build Coastguard Worker     bool IsEqualForTesting(const Entry& other) const;
69*6777b538SAndroid Build Coastguard Worker 
70*6777b538SAndroid Build Coastguard Worker     bool operator==(const Entry& other) const = delete;
71*6777b538SAndroid Build Coastguard Worker 
72*6777b538SAndroid Build Coastguard Worker    private:
73*6777b538SAndroid Build Coastguard Worker     friend class HttpAuthCache;
74*6777b538SAndroid Build Coastguard Worker     FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath);
75*6777b538SAndroid Build Coastguard Worker     FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddToExistingEntry);
76*6777b538SAndroid Build Coastguard Worker 
77*6777b538SAndroid Build Coastguard Worker     typedef std::list<std::string> PathList;
78*6777b538SAndroid Build Coastguard Worker 
79*6777b538SAndroid Build Coastguard Worker     Entry();
80*6777b538SAndroid Build Coastguard Worker 
81*6777b538SAndroid Build Coastguard Worker     // Adds a path defining the realm's protection space. If the path is
82*6777b538SAndroid Build Coastguard Worker     // already contained in the protection space, is a no-op.
83*6777b538SAndroid Build Coastguard Worker     void AddPath(const std::string& path);
84*6777b538SAndroid Build Coastguard Worker 
85*6777b538SAndroid Build Coastguard Worker     // Returns true if |dir| is contained within the realm's protection
86*6777b538SAndroid Build Coastguard Worker     // space.  |*path_len| is set to the length of the enclosing path if
87*6777b538SAndroid Build Coastguard Worker     // such a path exists and |path_len| is non-nullptr.  If no enclosing
88*6777b538SAndroid Build Coastguard Worker     // path is found, |*path_len| is left unmodified.
89*6777b538SAndroid Build Coastguard Worker     //
90*6777b538SAndroid Build Coastguard Worker     // If an enclosing path is found, moves it up by one place in the paths list
91*6777b538SAndroid Build Coastguard Worker     // so that more frequently used paths migrate to the front of the list.
92*6777b538SAndroid Build Coastguard Worker     //
93*6777b538SAndroid Build Coastguard Worker     // Note that proxy auth cache entries are associated with empty
94*6777b538SAndroid Build Coastguard Worker     // paths.  Therefore it is possible for HasEnclosingPath() to return
95*6777b538SAndroid Build Coastguard Worker     // true and set |*path_len| to 0.
96*6777b538SAndroid Build Coastguard Worker     bool HasEnclosingPath(const std::string& dir, size_t* path_len);
97*6777b538SAndroid Build Coastguard Worker 
98*6777b538SAndroid Build Coastguard Worker     // SchemeHostPort of the server.
99*6777b538SAndroid Build Coastguard Worker     url::SchemeHostPort scheme_host_port_;
100*6777b538SAndroid Build Coastguard Worker     std::string realm_;
101*6777b538SAndroid Build Coastguard Worker     HttpAuth::Scheme scheme_ = HttpAuth::AUTH_SCHEME_MAX;
102*6777b538SAndroid Build Coastguard Worker 
103*6777b538SAndroid Build Coastguard Worker     // Identity.
104*6777b538SAndroid Build Coastguard Worker     std::string auth_challenge_;
105*6777b538SAndroid Build Coastguard Worker     AuthCredentials credentials_;
106*6777b538SAndroid Build Coastguard Worker 
107*6777b538SAndroid Build Coastguard Worker     int nonce_count_ = 0;
108*6777b538SAndroid Build Coastguard Worker 
109*6777b538SAndroid Build Coastguard Worker     // List of paths that define the realm's protection space.
110*6777b538SAndroid Build Coastguard Worker     PathList paths_;
111*6777b538SAndroid Build Coastguard Worker 
112*6777b538SAndroid Build Coastguard Worker     // Times the entry was created and last used (by looking up, adding a path,
113*6777b538SAndroid Build Coastguard Worker     // or updating the challenge.)
114*6777b538SAndroid Build Coastguard Worker     base::TimeTicks creation_time_ticks_;
115*6777b538SAndroid Build Coastguard Worker     base::TimeTicks last_use_time_ticks_;
116*6777b538SAndroid Build Coastguard Worker     base::Time creation_time_;
117*6777b538SAndroid Build Coastguard Worker   };
118*6777b538SAndroid Build Coastguard Worker 
119*6777b538SAndroid Build Coastguard Worker   // Prevent unbounded memory growth. These are safeguards for abuse; it is
120*6777b538SAndroid Build Coastguard Worker   // not expected that the limits will be reached in ordinary usage.
121*6777b538SAndroid Build Coastguard Worker   // This also defines the worst-case lookup times (which grow linearly
122*6777b538SAndroid Build Coastguard Worker   // with number of elements in the cache).
123*6777b538SAndroid Build Coastguard Worker   enum { kMaxNumPathsPerRealmEntry = 10 };
124*6777b538SAndroid Build Coastguard Worker   enum { kMaxNumRealmEntries = 20 };
125*6777b538SAndroid Build Coastguard Worker 
126*6777b538SAndroid Build Coastguard Worker   // If |key_server_entries_by_network_anonymization_key| is true, all
127*6777b538SAndroid Build Coastguard Worker   // HttpAuth::AUTH_SERVER operations are keyed by NetworkAnonymizationKey.
128*6777b538SAndroid Build Coastguard Worker   // Otherwise, NetworkAnonymizationKey arguments are ignored.
129*6777b538SAndroid Build Coastguard Worker   explicit HttpAuthCache(bool key_server_entries_by_network_anonymization_key);
130*6777b538SAndroid Build Coastguard Worker 
131*6777b538SAndroid Build Coastguard Worker   HttpAuthCache(const HttpAuthCache&) = delete;
132*6777b538SAndroid Build Coastguard Worker   HttpAuthCache& operator=(const HttpAuthCache&) = delete;
133*6777b538SAndroid Build Coastguard Worker 
134*6777b538SAndroid Build Coastguard Worker   ~HttpAuthCache();
135*6777b538SAndroid Build Coastguard Worker 
136*6777b538SAndroid Build Coastguard Worker   // Sets whether server entries are keyed by NetworkAnonymizationKey.
137*6777b538SAndroid Build Coastguard Worker   // If this results in changing the value of the setting, all current server
138*6777b538SAndroid Build Coastguard Worker   // entries are deleted.
139*6777b538SAndroid Build Coastguard Worker   void SetKeyServerEntriesByNetworkAnonymizationKey(
140*6777b538SAndroid Build Coastguard Worker       bool key_server_entries_by_network_anonymization_key);
141*6777b538SAndroid Build Coastguard Worker 
142*6777b538SAndroid Build Coastguard Worker   // Find the realm entry on server |origin| for realm |realm| and
143*6777b538SAndroid Build Coastguard Worker   // scheme |scheme|. If a matching entry is found, move it up by one place
144*6777b538SAndroid Build Coastguard Worker   // in the entries list, so that more frequently used entries migrate to the
145*6777b538SAndroid Build Coastguard Worker   // front of the list.
146*6777b538SAndroid Build Coastguard Worker   //   |scheme_host_port| - the {scheme, host, port} of the server.
147*6777b538SAndroid Build Coastguard Worker   //   |target| - whether this is for server or proxy auth.
148*6777b538SAndroid Build Coastguard Worker   //   |realm|  - case sensitive realm string.
149*6777b538SAndroid Build Coastguard Worker   //   |scheme| - the authentication scheme (i.e. basic, negotiate).
150*6777b538SAndroid Build Coastguard Worker   //   returns  - the matched entry or nullptr.
151*6777b538SAndroid Build Coastguard Worker   Entry* Lookup(const url::SchemeHostPort& scheme_host_port,
152*6777b538SAndroid Build Coastguard Worker                 HttpAuth::Target target,
153*6777b538SAndroid Build Coastguard Worker                 const std::string& realm,
154*6777b538SAndroid Build Coastguard Worker                 HttpAuth::Scheme scheme,
155*6777b538SAndroid Build Coastguard Worker                 const NetworkAnonymizationKey& network_anonymization_key);
156*6777b538SAndroid Build Coastguard Worker 
157*6777b538SAndroid Build Coastguard Worker   // Find the entry on server |origin| whose protection space includes
158*6777b538SAndroid Build Coastguard Worker   // |path|. This uses the assumption in RFC 2617 section 2 that deeper
159*6777b538SAndroid Build Coastguard Worker   // paths lie in the same protection space. If a matching entry is found, move
160*6777b538SAndroid Build Coastguard Worker   // it up by one place in the entries list, so that more frequently used
161*6777b538SAndroid Build Coastguard Worker   // entries migrate to the front of the list.
162*6777b538SAndroid Build Coastguard Worker   //   |scheme_host_port| - the {scheme, host, port} of the server.
163*6777b538SAndroid Build Coastguard Worker   //   |path|   - absolute path of the resource, or empty string in case of
164*6777b538SAndroid Build Coastguard Worker   //              proxy auth (which does not use the concept of paths).
165*6777b538SAndroid Build Coastguard Worker   //   returns  - the matched entry or nullptr.
166*6777b538SAndroid Build Coastguard Worker   Entry* LookupByPath(const url::SchemeHostPort& scheme_host_port,
167*6777b538SAndroid Build Coastguard Worker                       HttpAuth::Target target,
168*6777b538SAndroid Build Coastguard Worker                       const NetworkAnonymizationKey& network_anonymization_key,
169*6777b538SAndroid Build Coastguard Worker                       const std::string& path);
170*6777b538SAndroid Build Coastguard Worker 
171*6777b538SAndroid Build Coastguard Worker   // Add an entry on server |scheme_host_port| for realm |handler->realm()| and
172*6777b538SAndroid Build Coastguard Worker   // scheme |handler->scheme()|.  If an entry for this (realm,scheme)
173*6777b538SAndroid Build Coastguard Worker   // already exists, update it rather than replace it -- this  preserves the
174*6777b538SAndroid Build Coastguard Worker   // paths list.
175*6777b538SAndroid Build Coastguard Worker   //   |scheme_host_port| - the {scheme, host, port} of the server.
176*6777b538SAndroid Build Coastguard Worker   //   |realm|    - the auth realm for the challenge.
177*6777b538SAndroid Build Coastguard Worker   //   |scheme|   - the authentication scheme (i.e. basic, negotiate).
178*6777b538SAndroid Build Coastguard Worker   //   |credentials| - login information for the realm.
179*6777b538SAndroid Build Coastguard Worker   //   |path|     - absolute path for a resource contained in the protection
180*6777b538SAndroid Build Coastguard Worker   //                space; this will be added to the list of known paths.
181*6777b538SAndroid Build Coastguard Worker   //   returns    - the entry that was just added/updated.
182*6777b538SAndroid Build Coastguard Worker   Entry* Add(const url::SchemeHostPort& scheme_host_port,
183*6777b538SAndroid Build Coastguard Worker              HttpAuth::Target target,
184*6777b538SAndroid Build Coastguard Worker              const std::string& realm,
185*6777b538SAndroid Build Coastguard Worker              HttpAuth::Scheme scheme,
186*6777b538SAndroid Build Coastguard Worker              const NetworkAnonymizationKey& network_anonymization_key,
187*6777b538SAndroid Build Coastguard Worker              const std::string& auth_challenge,
188*6777b538SAndroid Build Coastguard Worker              const AuthCredentials& credentials,
189*6777b538SAndroid Build Coastguard Worker              const std::string& path);
190*6777b538SAndroid Build Coastguard Worker 
191*6777b538SAndroid Build Coastguard Worker   // Remove entry on server |origin| for realm |realm| and scheme |scheme|
192*6777b538SAndroid Build Coastguard Worker   // if one exists AND if the cached credentials matches |credentials|.
193*6777b538SAndroid Build Coastguard Worker   //   |scheme_host_port| - the {scheme, host, port} of the server.
194*6777b538SAndroid Build Coastguard Worker   //   |realm|    - case sensitive realm string.
195*6777b538SAndroid Build Coastguard Worker   //   |scheme|   - the authentication scheme (i.e. basic, negotiate).
196*6777b538SAndroid Build Coastguard Worker   //   |credentials| - the credentials to match.
197*6777b538SAndroid Build Coastguard Worker   //   returns    - true if an entry was removed.
198*6777b538SAndroid Build Coastguard Worker   bool Remove(const url::SchemeHostPort& scheme_host_port,
199*6777b538SAndroid Build Coastguard Worker               HttpAuth::Target target,
200*6777b538SAndroid Build Coastguard Worker               const std::string& realm,
201*6777b538SAndroid Build Coastguard Worker               HttpAuth::Scheme scheme,
202*6777b538SAndroid Build Coastguard Worker               const NetworkAnonymizationKey& network_anonymization_key,
203*6777b538SAndroid Build Coastguard Worker               const AuthCredentials& credentials);
204*6777b538SAndroid Build Coastguard Worker 
205*6777b538SAndroid Build Coastguard Worker   // Clears cache entries added between |begin_time| inclusively and |end_time|
206*6777b538SAndroid Build Coastguard Worker   // exclusively. Clears all entries if |begin_time| and |end_time| are equal to
207*6777b538SAndroid Build Coastguard Worker   // base::Time::Min() and base::Time::Max() respectively.
208*6777b538SAndroid Build Coastguard Worker   void ClearEntriesAddedBetween(
209*6777b538SAndroid Build Coastguard Worker       base::Time begin_time,
210*6777b538SAndroid Build Coastguard Worker       base::Time end_time,
211*6777b538SAndroid Build Coastguard Worker       base::RepeatingCallback<bool(const GURL&)> url_matcher);
212*6777b538SAndroid Build Coastguard Worker 
213*6777b538SAndroid Build Coastguard Worker   // Clears all added entries.
214*6777b538SAndroid Build Coastguard Worker   void ClearAllEntries();
215*6777b538SAndroid Build Coastguard Worker 
216*6777b538SAndroid Build Coastguard Worker   // Updates a stale digest entry on server |scheme_host_port| for realm |realm|
217*6777b538SAndroid Build Coastguard Worker   // and scheme |scheme|. The cached auth challenge is replaced with
218*6777b538SAndroid Build Coastguard Worker   // |auth_challenge| and the nonce count is reset.
219*6777b538SAndroid Build Coastguard Worker   // |UpdateStaleChallenge()| returns true if a matching entry exists in the
220*6777b538SAndroid Build Coastguard Worker   // cache, false otherwise.
221*6777b538SAndroid Build Coastguard Worker   bool UpdateStaleChallenge(
222*6777b538SAndroid Build Coastguard Worker       const url::SchemeHostPort& scheme_host_port,
223*6777b538SAndroid Build Coastguard Worker       HttpAuth::Target target,
224*6777b538SAndroid Build Coastguard Worker       const std::string& realm,
225*6777b538SAndroid Build Coastguard Worker       HttpAuth::Scheme scheme,
226*6777b538SAndroid Build Coastguard Worker       const NetworkAnonymizationKey& network_anonymization_key,
227*6777b538SAndroid Build Coastguard Worker       const std::string& auth_challenge);
228*6777b538SAndroid Build Coastguard Worker 
229*6777b538SAndroid Build Coastguard Worker   // Copies all entries from |other| cache with a target of
230*6777b538SAndroid Build Coastguard Worker   // HttpAuth::AUTH_PROXY. |this| and |other| need not have the same
231*6777b538SAndroid Build Coastguard Worker   // |key_server_entries_by_network_anonymization_key_| value, since proxy
232*6777b538SAndroid Build Coastguard Worker   // credentials are not keyed on NetworkAnonymizationKey.
233*6777b538SAndroid Build Coastguard Worker   void CopyProxyEntriesFrom(const HttpAuthCache& other);
234*6777b538SAndroid Build Coastguard Worker 
235*6777b538SAndroid Build Coastguard Worker   size_t GetEntriesSizeForTesting();
set_tick_clock_for_testing(const base::TickClock * tick_clock)236*6777b538SAndroid Build Coastguard Worker   void set_tick_clock_for_testing(const base::TickClock* tick_clock) {
237*6777b538SAndroid Build Coastguard Worker     tick_clock_ = tick_clock;
238*6777b538SAndroid Build Coastguard Worker   }
set_clock_for_testing(const base::Clock * clock)239*6777b538SAndroid Build Coastguard Worker   void set_clock_for_testing(const base::Clock* clock) { clock_ = clock; }
240*6777b538SAndroid Build Coastguard Worker 
key_server_entries_by_network_anonymization_key()241*6777b538SAndroid Build Coastguard Worker   bool key_server_entries_by_network_anonymization_key() const {
242*6777b538SAndroid Build Coastguard Worker     return key_server_entries_by_network_anonymization_key_;
243*6777b538SAndroid Build Coastguard Worker   }
244*6777b538SAndroid Build Coastguard Worker 
245*6777b538SAndroid Build Coastguard Worker  private:
246*6777b538SAndroid Build Coastguard Worker   struct EntryMapKey {
247*6777b538SAndroid Build Coastguard Worker     EntryMapKey(const url::SchemeHostPort& scheme_host_port,
248*6777b538SAndroid Build Coastguard Worker                 HttpAuth::Target target,
249*6777b538SAndroid Build Coastguard Worker                 const NetworkAnonymizationKey& network_anonymization_key,
250*6777b538SAndroid Build Coastguard Worker                 bool key_server_entries_by_network_anonymization_key);
251*6777b538SAndroid Build Coastguard Worker     ~EntryMapKey();
252*6777b538SAndroid Build Coastguard Worker 
253*6777b538SAndroid Build Coastguard Worker     bool operator<(const EntryMapKey& other) const;
254*6777b538SAndroid Build Coastguard Worker 
255*6777b538SAndroid Build Coastguard Worker     url::SchemeHostPort scheme_host_port;
256*6777b538SAndroid Build Coastguard Worker     HttpAuth::Target target;
257*6777b538SAndroid Build Coastguard Worker     // Empty if |key_server_entries_by_network_anonymization_key| is false,
258*6777b538SAndroid Build Coastguard Worker     // |target| is HttpAuth::AUTH_PROXY, or an empty NetworkAnonymizationKey is
259*6777b538SAndroid Build Coastguard Worker     // passed in to the EntryMap constructor.
260*6777b538SAndroid Build Coastguard Worker     NetworkAnonymizationKey network_anonymization_key;
261*6777b538SAndroid Build Coastguard Worker   };
262*6777b538SAndroid Build Coastguard Worker 
263*6777b538SAndroid Build Coastguard Worker   using EntryMap = std::multimap<EntryMapKey, Entry>;
264*6777b538SAndroid Build Coastguard Worker 
265*6777b538SAndroid Build Coastguard Worker   raw_ptr<const base::TickClock> tick_clock_ =
266*6777b538SAndroid Build Coastguard Worker       base::DefaultTickClock::GetInstance();
267*6777b538SAndroid Build Coastguard Worker   raw_ptr<const base::Clock> clock_ = base::DefaultClock::GetInstance();
268*6777b538SAndroid Build Coastguard Worker 
269*6777b538SAndroid Build Coastguard Worker   EntryMap::iterator LookupEntryIt(
270*6777b538SAndroid Build Coastguard Worker       const url::SchemeHostPort& scheme_host_port,
271*6777b538SAndroid Build Coastguard Worker       HttpAuth::Target target,
272*6777b538SAndroid Build Coastguard Worker       const std::string& realm,
273*6777b538SAndroid Build Coastguard Worker       HttpAuth::Scheme scheme,
274*6777b538SAndroid Build Coastguard Worker       const NetworkAnonymizationKey& network_anonymization_key);
275*6777b538SAndroid Build Coastguard Worker 
276*6777b538SAndroid Build Coastguard Worker   void EvictLeastRecentlyUsedEntry();
277*6777b538SAndroid Build Coastguard Worker 
278*6777b538SAndroid Build Coastguard Worker   bool key_server_entries_by_network_anonymization_key_;
279*6777b538SAndroid Build Coastguard Worker 
280*6777b538SAndroid Build Coastguard Worker   EntryMap entries_;
281*6777b538SAndroid Build Coastguard Worker };
282*6777b538SAndroid Build Coastguard Worker 
283*6777b538SAndroid Build Coastguard Worker // An authentication realm entry.
284*6777b538SAndroid Build Coastguard Worker }  // namespace net
285*6777b538SAndroid Build Coastguard Worker 
286*6777b538SAndroid Build Coastguard Worker #endif  // NET_HTTP_HTTP_AUTH_CACHE_H_
287