OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_HTTP_HTTP_AUTH_CACHE_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_CACHE_H_ |
6 #define NET_HTTP_HTTP_AUTH_CACHE_H_ | 6 #define NET_HTTP_HTTP_AUTH_CACHE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // - the last identity used (username/password) | 24 // - the last identity used (username/password) |
25 // - the last auth handler used (contains realm and authentication scheme) | 25 // - the last auth handler used (contains realm and authentication scheme) |
26 // - the list of paths which used this realm | 26 // - the list of paths which used this realm |
27 // Entries can be looked up by either (origin, realm, scheme) or (origin, path). | 27 // Entries can be looked up by either (origin, realm, scheme) or (origin, path). |
28 class NET_EXPORT_PRIVATE HttpAuthCache { | 28 class NET_EXPORT_PRIVATE HttpAuthCache { |
29 public: | 29 public: |
30 class NET_EXPORT_PRIVATE Entry { | 30 class NET_EXPORT_PRIVATE Entry { |
31 public: | 31 public: |
32 ~Entry(); | 32 ~Entry(); |
33 | 33 |
34 const GURL& origin() const { | 34 const GURL& origin() const { return origin_; } |
35 return origin_; | |
36 } | |
37 | 35 |
38 // The case-sensitive realm string of the challenge. | 36 // The case-sensitive realm string of the challenge. |
39 const std::string realm() const { | 37 const std::string realm() const { return realm_; } |
40 return realm_; | |
41 } | |
42 | 38 |
43 // The authentication scheme of the challenge. | 39 // The authentication scheme of the challenge. |
44 HttpAuth::Scheme scheme() const { | 40 HttpAuth::Scheme scheme() const { return scheme_; } |
45 return scheme_; | |
46 } | |
47 | 41 |
48 // The authentication challenge. | 42 // The authentication challenge. |
49 const std::string auth_challenge() const { | 43 const std::string auth_challenge() const { return auth_challenge_; } |
50 return auth_challenge_; | |
51 } | |
52 | 44 |
53 // The login credentials. | 45 // The login credentials. |
54 const AuthCredentials& credentials() const { | 46 const AuthCredentials& credentials() const { return credentials_; } |
55 return credentials_; | |
56 } | |
57 | 47 |
58 int IncrementNonceCount() { | 48 int IncrementNonceCount() { return ++nonce_count_; } |
59 return ++nonce_count_; | |
60 } | |
61 | 49 |
62 void UpdateStaleChallenge(const std::string& auth_challenge); | 50 void UpdateStaleChallenge(const std::string& auth_challenge); |
63 | 51 |
64 private: | 52 private: |
65 friend class HttpAuthCache; | 53 friend class HttpAuthCache; |
66 FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath); | 54 FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath); |
67 FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddToExistingEntry); | 55 FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddToExistingEntry); |
68 | 56 |
69 typedef std::list<std::string> PathList; | 57 typedef std::list<std::string> PathList; |
70 | 58 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 166 |
179 private: | 167 private: |
180 typedef std::list<Entry> EntryList; | 168 typedef std::list<Entry> EntryList; |
181 EntryList entries_; | 169 EntryList entries_; |
182 }; | 170 }; |
183 | 171 |
184 // An authentication realm entry. | 172 // An authentication realm entry. |
185 } // namespace net | 173 } // namespace net |
186 | 174 |
187 #endif // NET_HTTP_HTTP_AUTH_CACHE_H_ | 175 #endif // NET_HTTP_HTTP_AUTH_CACHE_H_ |
OLD | NEW |