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_HANDLER_BASIC_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/http/http_auth_handler.h" | 11 #include "net/http/http_auth_handler.h" |
12 #include "net/http/http_auth_handler_factory.h" | 12 #include "net/http/http_auth_handler_factory.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // Code for handling http basic authentication. | 16 // Code for handling http basic authentication. |
17 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { | 17 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { |
18 public: | 18 public: |
19 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { | 19 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { |
20 public: | 20 public: |
21 Factory(); | 21 Factory(); |
22 ~Factory() override; | 22 ~Factory() override; |
23 | 23 |
24 int CreateAuthHandler(const HttpAuthChallengeTokenizer& challenge, | 24 // HttpAuthHandlerFactory |
25 HttpAuth::Target target, | 25 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme( |
26 const GURL& origin, | 26 const std::string& scheme) override; |
27 CreateReason reason, | 27 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler( |
28 int digest_nonce_count, | 28 HttpAuthCache::Entry* cache_entry, |
29 const BoundNetLog& net_log, | 29 const HttpAuthChallengeTokenizer& tokenizer, |
30 scoped_ptr<HttpAuthHandler>* handler) override; | 30 HttpAuth::Target target, |
| 31 const BoundNetLog& net_log) override; |
31 }; | 32 }; |
32 | 33 |
| 34 ~HttpAuthHandlerBasic() override {} |
| 35 |
| 36 // HttpAuthHandler |
33 HttpAuth::AuthorizationResult HandleAnotherChallenge( | 37 HttpAuth::AuthorizationResult HandleAnotherChallenge( |
34 const HttpAuthChallengeTokenizer& challenge) override; | 38 const HttpAuthChallengeTokenizer& challenge) override; |
35 | 39 |
36 protected: | 40 protected: |
| 41 // HttpAuthHandler |
37 int Init(const HttpAuthChallengeTokenizer& challenge) override; | 42 int Init(const HttpAuthChallengeTokenizer& challenge) override; |
38 | |
39 int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 43 int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
40 const HttpRequestInfo& request, | 44 const HttpRequestInfo& request, |
41 const CompletionCallback& callback, | 45 const CompletionCallback& callback, |
42 std::string* auth_token) override; | 46 std::string* auth_token) override; |
43 | 47 |
44 private: | 48 private: |
45 ~HttpAuthHandlerBasic() override {} | 49 HttpAuthHandlerBasic(); |
46 | |
47 int ParseChallenge(const HttpAuthChallengeTokenizer& challenge); | 50 int ParseChallenge(const HttpAuthChallengeTokenizer& challenge); |
48 }; | 51 }; |
49 | 52 |
50 } // namespace net | 53 } // namespace net |
51 | 54 |
52 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 55 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
OLD | NEW |