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_DIGEST_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 private: | 77 private: |
78 scoped_ptr<const NonceGenerator> nonce_generator_; | 78 scoped_ptr<const NonceGenerator> nonce_generator_; |
79 }; | 79 }; |
80 | 80 |
81 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 81 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
82 HttpAuth::ChallengeTokenizer* challenge); | 82 HttpAuth::ChallengeTokenizer* challenge); |
83 | 83 |
84 protected: | 84 protected: |
85 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 85 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
86 | 86 |
87 virtual int GenerateAuthTokenImpl(const string16* username, | 87 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
88 const string16* password, | |
89 const HttpRequestInfo* request, | 88 const HttpRequestInfo* request, |
90 OldCompletionCallback* callback, | 89 OldCompletionCallback* callback, |
91 std::string* auth_token); | 90 std::string* auth_token); |
92 | 91 |
93 private: | 92 private: |
94 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDigestTest, ParseChallenge); | 93 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDigestTest, ParseChallenge); |
95 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDigestTest, AssembleCredentials); | 94 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDigestTest, AssembleCredentials); |
96 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, DigestPreAuthNonceCount); | 95 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, DigestPreAuthNonceCount); |
97 | 96 |
98 // Possible values for the "algorithm" property. | 97 // Possible values for the "algorithm" property. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 // Extract the method and path of the request, as needed by | 141 // Extract the method and path of the request, as needed by |
143 // the 'A2' production. (path may be a hostname for proxy). | 142 // the 'A2' production. (path may be a hostname for proxy). |
144 void GetRequestMethodAndPath(const HttpRequestInfo* request, | 143 void GetRequestMethodAndPath(const HttpRequestInfo* request, |
145 std::string* method, | 144 std::string* method, |
146 std::string* path) const; | 145 std::string* path) const; |
147 | 146 |
148 // Build up the 'response' production. | 147 // Build up the 'response' production. |
149 std::string AssembleResponseDigest(const std::string& method, | 148 std::string AssembleResponseDigest(const std::string& method, |
150 const std::string& path, | 149 const std::string& path, |
151 const string16& username, | 150 const AuthCredentials& credentials, |
152 const string16& password, | |
153 const std::string& cnonce, | 151 const std::string& cnonce, |
154 const std::string& nc) const; | 152 const std::string& nc) const; |
155 | 153 |
156 // Build up the value for (Authorization/Proxy-Authorization). | 154 // Build up the value for (Authorization/Proxy-Authorization). |
157 std::string AssembleCredentials(const std::string& method, | 155 std::string AssembleCredentials(const std::string& method, |
158 const std::string& path, | 156 const std::string& path, |
159 const string16& username, | 157 const AuthCredentials& credentials, |
160 const string16& password, | |
161 const std::string& cnonce, | 158 const std::string& cnonce, |
162 int nonce_count) const; | 159 int nonce_count) const; |
163 | 160 |
164 // Information parsed from the challenge. | 161 // Information parsed from the challenge. |
165 std::string nonce_; | 162 std::string nonce_; |
166 std::string domain_; | 163 std::string domain_; |
167 std::string opaque_; | 164 std::string opaque_; |
168 bool stale_; | 165 bool stale_; |
169 DigestAlgorithm algorithm_; | 166 DigestAlgorithm algorithm_; |
170 QualityOfProtection qop_; | 167 QualityOfProtection qop_; |
171 | 168 |
172 // The realm as initially encoded over-the-wire. This is used in the | 169 // The realm as initially encoded over-the-wire. This is used in the |
173 // challenge text, rather than |realm_| which has been converted to | 170 // challenge text, rather than |realm_| which has been converted to |
174 // UTF-8. | 171 // UTF-8. |
175 std::string original_realm_; | 172 std::string original_realm_; |
176 | 173 |
177 int nonce_count_; | 174 int nonce_count_; |
178 const NonceGenerator* nonce_generator_; | 175 const NonceGenerator* nonce_generator_; |
179 }; | 176 }; |
180 | 177 |
181 } // namespace net | 178 } // namespace net |
182 | 179 |
183 #endif // NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ | 180 #endif // NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
OLD | NEW |