| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_HANDLER_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_HANDLER_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "net/http/http_auth.h" | 11 #include "net/http/http_auth.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 class HttpRequestInfo; | 15 class HttpRequestInfo; |
| 16 class ProxyInfo; | 16 class ProxyInfo; |
| 17 | 17 |
| 18 // HttpAuthHandler is the interface for the authentication schemes | 18 // HttpAuthHandler is the interface for the authentication schemes |
| 19 // (basic, digest, ...) | 19 // (basic, digest, ...) |
| 20 // The registry mapping auth-schemes to implementations is hardcoded in | 20 // The registry mapping auth-schemes to implementations is hardcoded in |
| 21 // HttpAuth::CreateAuthHandler(). | 21 // HttpAuth::CreateAuthHandler(). |
| 22 class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { | 22 class HttpAuthHandler : public base::RefCounted<HttpAuthHandler> { |
| 23 public: | 23 public: |
| 24 virtual ~HttpAuthHandler() { } | |
| 25 | |
| 26 // Initialize the handler by parsing a challenge string. | 24 // Initialize the handler by parsing a challenge string. |
| 27 bool InitFromChallenge(std::string::const_iterator begin, | 25 bool InitFromChallenge(std::string::const_iterator begin, |
| 28 std::string::const_iterator end, | 26 std::string::const_iterator end, |
| 29 HttpAuth::Target target, | 27 HttpAuth::Target target, |
| 30 const GURL& origin); | 28 const GURL& origin); |
| 31 | 29 |
| 32 // Lowercase name of the auth scheme | 30 // Lowercase name of the auth scheme |
| 33 const std::string& scheme() const { | 31 const std::string& scheme() const { |
| 34 return scheme_; | 32 return scheme_; |
| 35 } | 33 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const std::wstring& password, | 77 const std::wstring& password, |
| 80 const HttpRequestInfo* request, | 78 const HttpRequestInfo* request, |
| 81 const ProxyInfo* proxy) = 0; | 79 const ProxyInfo* proxy) = 0; |
| 82 | 80 |
| 83 protected: | 81 protected: |
| 84 enum Property { | 82 enum Property { |
| 85 ENCRYPTS_IDENTITY = 1 << 0, | 83 ENCRYPTS_IDENTITY = 1 << 0, |
| 86 IS_CONNECTION_BASED = 1 << 1, | 84 IS_CONNECTION_BASED = 1 << 1, |
| 87 }; | 85 }; |
| 88 | 86 |
| 87 friend class base::RefCounted<HttpAuthHandler>; |
| 88 |
| 89 virtual ~HttpAuthHandler() { } |
| 90 |
| 89 // Initialize the handler by parsing a challenge string. | 91 // Initialize the handler by parsing a challenge string. |
| 90 // Implementations are expcted to initialize the following members: | 92 // Implementations are expcted to initialize the following members: |
| 91 // scheme_, realm_, score_, properties_ | 93 // scheme_, realm_, score_, properties_ |
| 92 virtual bool Init(std::string::const_iterator challenge_begin, | 94 virtual bool Init(std::string::const_iterator challenge_begin, |
| 93 std::string::const_iterator challenge_end) = 0; | 95 std::string::const_iterator challenge_end) = 0; |
| 94 | 96 |
| 95 // The lowercase auth-scheme {"basic", "digest", "ntlm", ...} | 97 // The lowercase auth-scheme {"basic", "digest", "ntlm", ...} |
| 96 std::string scheme_; | 98 std::string scheme_; |
| 97 | 99 |
| 98 // The realm. Used by "basic" and "digest". | 100 // The realm. Used by "basic" and "digest". |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 // origin server. | 111 // origin server. |
| 110 HttpAuth::Target target_; | 112 HttpAuth::Target target_; |
| 111 | 113 |
| 112 // A bitmask of the properties of the authentication scheme. | 114 // A bitmask of the properties of the authentication scheme. |
| 113 int properties_; | 115 int properties_; |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 } // namespace net | 118 } // namespace net |
| 117 | 119 |
| 118 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_ | 120 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_ |
| OLD | NEW |