OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_NEGOTIATE_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // |use_port()| and |set_use_port()| get/set whether the auth handlers | 58 // |use_port()| and |set_use_port()| get/set whether the auth handlers |
59 // generated by this factory should include the port number of the server | 59 // generated by this factory should include the port number of the server |
60 // they are authenticating to when constructing a Kerberos SPN. The default | 60 // they are authenticating to when constructing a Kerberos SPN. The default |
61 // value is false. | 61 // value is false. |
62 bool use_port() const { return use_port_; } | 62 bool use_port() const { return use_port_; } |
63 void set_use_port(bool use_port) { use_port_ = use_port; } | 63 void set_use_port(bool use_port) { use_port_ = use_port; } |
64 | 64 |
65 void set_host_resolver(HostResolver* host_resolver); | 65 void set_host_resolver(HostResolver* host_resolver); |
66 | 66 |
| 67 // Sets the system library to use, thereby assuming ownership of |
| 68 // |auth_library|. |
| 69 void set_library(AuthLibrary* auth_library) { |
| 70 auth_library_.reset(auth_library); |
| 71 } |
| 72 |
67 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, | 73 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, |
68 HttpAuth::Target target, | 74 HttpAuth::Target target, |
69 const GURL& origin, | 75 const GURL& origin, |
70 CreateReason reason, | 76 CreateReason reason, |
71 int digest_nonce_count, | 77 int digest_nonce_count, |
72 const BoundNetLog& net_log, | 78 const BoundNetLog& net_log, |
73 scoped_ptr<HttpAuthHandler>* handler); | 79 scoped_ptr<HttpAuthHandler>* handler); |
74 | 80 |
75 // Sets the system library to use, thereby assuming ownership of | |
76 // |auth_library|. | |
77 void set_library(AuthLibrary* auth_library) { | |
78 auth_library_.reset(auth_library); | |
79 } | |
80 | |
81 private: | 81 private: |
82 bool disable_cname_lookup_; | 82 bool disable_cname_lookup_; |
83 bool use_port_; | 83 bool use_port_; |
84 HostResolver* resolver_; | 84 HostResolver* resolver_; |
85 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
86 ULONG max_token_length_; | 86 ULONG max_token_length_; |
87 bool first_creation_; | 87 bool first_creation_; |
88 bool is_unsupported_; | 88 bool is_unsupported_; |
89 #endif | 89 #endif |
90 scoped_ptr<AuthLibrary> auth_library_; | 90 scoped_ptr<AuthLibrary> auth_library_; |
91 }; | 91 }; |
92 | 92 |
93 HttpAuthHandlerNegotiate(AuthLibrary* sspi_library, | 93 HttpAuthHandlerNegotiate(AuthLibrary* sspi_library, |
94 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
95 ULONG max_token_length, | 95 ULONG max_token_length, |
96 #endif | 96 #endif |
97 URLSecurityManager* url_security_manager, | 97 URLSecurityManager* url_security_manager, |
98 HostResolver* host_resolver, | 98 HostResolver* host_resolver, |
99 bool disable_cname_lookup, | 99 bool disable_cname_lookup, |
100 bool use_port); | 100 bool use_port); |
101 | 101 |
102 virtual ~HttpAuthHandlerNegotiate(); | 102 virtual ~HttpAuthHandlerNegotiate(); |
103 | 103 |
104 virtual bool NeedsIdentity(); | |
105 | |
106 virtual bool AllowsDefaultCredentials(); | |
107 | |
108 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | |
109 HttpAuth::ChallengeTokenizer* challenge); | |
110 | |
111 // These are public for unit tests | 104 // These are public for unit tests |
112 std::wstring CreateSPN(const AddressList& address_list, const GURL& orign); | 105 std::wstring CreateSPN(const AddressList& address_list, const GURL& orign); |
113 const std::wstring& spn() const { return spn_; } | 106 const std::wstring& spn() const { return spn_; } |
114 | 107 |
| 108 // HttpAuthHandler: |
| 109 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 110 HttpAuth::ChallengeTokenizer* challenge); |
| 111 virtual bool NeedsIdentity(); |
| 112 virtual bool AllowsDefaultCredentials(); |
| 113 |
115 protected: | 114 protected: |
116 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 115 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
117 | 116 |
118 virtual int GenerateAuthTokenImpl(const string16* username, | 117 virtual int GenerateAuthTokenImpl(const string16* username, |
119 const string16* password, | 118 const string16* password, |
120 const HttpRequestInfo* request, | 119 const HttpRequestInfo* request, |
121 CompletionCallback* callback, | 120 CompletionCallback* callback, |
122 std::string* auth_token); | 121 std::string* auth_token); |
123 | 122 |
124 private: | 123 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 std::string* auth_token_; | 161 std::string* auth_token_; |
163 | 162 |
164 State next_state_; | 163 State next_state_; |
165 | 164 |
166 const URLSecurityManager* url_security_manager_; | 165 const URLSecurityManager* url_security_manager_; |
167 }; | 166 }; |
168 | 167 |
169 } // namespace net | 168 } // namespace net |
170 | 169 |
171 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 170 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
OLD | NEW |