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_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 "base/string16.h" |
14 #include "net/http/http_auth.h" | 14 #include "net/http/http_auth.h" |
15 | 15 |
16 #define GSS_USE_FUNCTION_POINTERS | 16 #define GSS_USE_FUNCTION_POINTERS |
17 #include "net/third_party/gssapi/gssapi.h" | 17 #include "net/third_party/gssapi/gssapi.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class HttpRequestInfo; | 23 struct HttpRequestInfo; |
24 | 24 |
25 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; | 25 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; |
26 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; | 26 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; |
27 extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; | 27 extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; |
28 | 28 |
29 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI | 29 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI |
30 // library. The default implementation attempts to load one of the standard | 30 // library. The default implementation attempts to load one of the standard |
31 // GSSAPI library implementations, then simply passes the arguments on to | 31 // GSSAPI library implementations, then simply passes the arguments on to |
32 // that implementation. | 32 // that implementation. |
33 class GSSAPILibrary { | 33 class GSSAPILibrary { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 gss_inquire_context_type inquire_context_; | 198 gss_inquire_context_type inquire_context_; |
199 }; | 199 }; |
200 | 200 |
201 // 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 |
202 // scope. | 202 // scope. |
203 class ScopedSecurityContext { | 203 class ScopedSecurityContext { |
204 public: | 204 public: |
205 explicit ScopedSecurityContext(GSSAPILibrary* gssapi_lib); | 205 explicit ScopedSecurityContext(GSSAPILibrary* gssapi_lib); |
206 ~ScopedSecurityContext(); | 206 ~ScopedSecurityContext(); |
207 | 207 |
208 const gss_ctx_id_t get() const { return security_context_; } | 208 gss_ctx_id_t get() const { return security_context_; } |
209 gss_ctx_id_t* receive() { return &security_context_; } | 209 gss_ctx_id_t* receive() { return &security_context_; } |
210 | 210 |
211 private: | 211 private: |
212 gss_ctx_id_t security_context_; | 212 gss_ctx_id_t security_context_; |
213 GSSAPILibrary* gssapi_lib_; | 213 GSSAPILibrary* gssapi_lib_; |
214 | 214 |
215 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); | 215 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); |
216 }; | 216 }; |
217 | 217 |
218 | 218 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 string16 password_; | 256 string16 password_; |
257 gss_OID gss_oid_; | 257 gss_OID gss_oid_; |
258 GSSAPILibrary* library_; | 258 GSSAPILibrary* library_; |
259 std::string decoded_server_auth_token_; | 259 std::string decoded_server_auth_token_; |
260 ScopedSecurityContext scoped_sec_context_; | 260 ScopedSecurityContext scoped_sec_context_; |
261 }; | 261 }; |
262 | 262 |
263 } // namespace net | 263 } // namespace net |
264 | 264 |
265 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 265 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
OLD | NEW |