Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: net/http/http_auth_gssapi_posix.h

Issue 3040016: Net: Convert username and password to string16. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address comments Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/http/http_auth_gssapi_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
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_GSSAPI_POSIX_H_ 5 #ifndef NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_
6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ 6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/native_library.h" 12 #include "base/native_library.h"
13 #include "base/string16.h"
13 #include "net/http/http_auth.h" 14 #include "net/http/http_auth.h"
14 15
15 #define GSS_USE_FUNCTION_POINTERS 16 #define GSS_USE_FUNCTION_POINTERS
16 #include "net/third_party/gssapi/gssapi.h" 17 #include "net/third_party/gssapi/gssapi.h"
17 18
18 class GURL; 19 class GURL;
19 20
20 namespace net { 21 namespace net {
21 22
22 class HttpRequestInfo; 23 class HttpRequestInfo;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 gss_init_sec_context_type init_sec_context_; 195 gss_init_sec_context_type init_sec_context_;
195 gss_wrap_size_limit_type wrap_size_limit_; 196 gss_wrap_size_limit_type wrap_size_limit_;
196 gss_delete_sec_context_type delete_sec_context_; 197 gss_delete_sec_context_type delete_sec_context_;
197 gss_inquire_context_type inquire_context_; 198 gss_inquire_context_type inquire_context_;
198 }; 199 };
199 200
200 // ScopedSecurityContext releases a gss_ctx_id_t when it goes out of 201 // ScopedSecurityContext releases a gss_ctx_id_t when it goes out of
201 // scope. 202 // scope.
202 class ScopedSecurityContext { 203 class ScopedSecurityContext {
203 public: 204 public:
204 ScopedSecurityContext(GSSAPILibrary* gssapi_lib); 205 explicit ScopedSecurityContext(GSSAPILibrary* gssapi_lib);
205 ~ScopedSecurityContext(); 206 ~ScopedSecurityContext();
206 207
207 const gss_ctx_id_t get() const { return security_context_; } 208 const gss_ctx_id_t get() const { return security_context_; }
208 gss_ctx_id_t* receive() { return &security_context_; } 209 gss_ctx_id_t* receive() { return &security_context_; }
209 210
210 private: 211 private:
211 gss_ctx_id_t security_context_; 212 gss_ctx_id_t security_context_;
212 GSSAPILibrary* gssapi_lib_; 213 GSSAPILibrary* gssapi_lib_;
213 214
214 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); 215 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext);
(...skipping 16 matching lines...) Expand all
231 bool ParseChallenge(HttpAuth::ChallengeTokenizer* tok); 232 bool ParseChallenge(HttpAuth::ChallengeTokenizer* tok);
232 233
233 // Generates an authentication token. 234 // Generates an authentication token.
234 // The return value is an error code. If it's not |OK|, the value of 235 // The return value is an error code. If it's not |OK|, the value of
235 // |*auth_token| is unspecified. 236 // |*auth_token| is unspecified.
236 // |spn| is the Service Principal Name of the server that the token is 237 // |spn| is the Service Principal Name of the server that the token is
237 // being generated for. 238 // being generated for.
238 // If this is the first round of a multiple round scheme, credentials are 239 // If this is the first round of a multiple round scheme, credentials are
239 // obtained using |*username| and |*password|. If |username| and |password| 240 // obtained using |*username| and |*password|. If |username| and |password|
240 // are NULL, the default credentials are used instead. 241 // are NULL, the default credentials are used instead.
241 int GenerateAuthToken(const std::wstring* username, 242 int GenerateAuthToken(const string16* username,
242 const std::wstring* password, 243 const string16* password,
243 const std::wstring& spn, 244 const std::wstring& spn,
244 std::string* auth_token); 245 std::string* auth_token);
245 246
246 private: 247 private:
247 int OnFirstRound(const std::wstring* username, 248 int OnFirstRound(const string16* username,
248 const std::wstring* password); 249 const string16* password);
249 int GetNextSecurityToken(const std::wstring& spn, 250 int GetNextSecurityToken(const std::wstring& spn,
250 gss_buffer_t in_token, 251 gss_buffer_t in_token,
251 gss_buffer_t out_token); 252 gss_buffer_t out_token);
252 253
253 std::string scheme_; 254 std::string scheme_;
254 std::wstring username_; 255 string16 username_;
255 std::wstring password_; 256 string16 password_;
256 gss_OID gss_oid_; 257 gss_OID gss_oid_;
257 GSSAPILibrary* library_; 258 GSSAPILibrary* library_;
258 std::string decoded_server_auth_token_; 259 std::string decoded_server_auth_token_;
259 ScopedSecurityContext scoped_sec_context_; 260 ScopedSecurityContext scoped_sec_context_;
260 }; 261 };
261 262
262 } // namespace net 263 } // namespace net
263 264
264 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ 265 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_
OLDNEW
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/http/http_auth_gssapi_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698