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_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/base/net_api.h" | 14 #include "net/base/net_export.h" |
15 #include "net/http/http_auth.h" | 15 #include "net/http/http_auth.h" |
16 | 16 |
17 #define GSS_USE_FUNCTION_POINTERS | 17 #define GSS_USE_FUNCTION_POINTERS |
18 #include "net/third_party/gssapi/gssapi.h" | 18 #include "net/third_party/gssapi/gssapi.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 NET_TEST extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; | 22 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; |
23 NET_TEST extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; | 23 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; |
24 NET_TEST extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; | 24 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; |
25 | 25 |
26 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI | 26 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI |
27 // library. The default implementation attempts to load one of the standard | 27 // library. The default implementation attempts to load one of the standard |
28 // GSSAPI library implementations, then simply passes the arguments on to | 28 // GSSAPI library implementations, then simply passes the arguments on to |
29 // that implementation. | 29 // that implementation. |
30 class NET_TEST GSSAPILibrary { | 30 class NET_EXPORT_PRIVATE GSSAPILibrary { |
31 public: | 31 public: |
32 virtual ~GSSAPILibrary() {} | 32 virtual ~GSSAPILibrary() {} |
33 | 33 |
34 // Initializes the library, including any necessary dynamic libraries. | 34 // Initializes the library, including any necessary dynamic libraries. |
35 // This is done separately from construction (which happens at startup time) | 35 // This is done separately from construction (which happens at startup time) |
36 // in order to delay work until the class is actually needed. | 36 // in order to delay work until the class is actually needed. |
37 virtual bool Init() = 0; | 37 virtual bool Init() = 0; |
38 | 38 |
39 // These methods match the ones in the GSSAPI library. | 39 // These methods match the ones in the GSSAPI library. |
40 virtual OM_uint32 import_name( | 40 virtual OM_uint32 import_name( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 gss_name_t* targ_name, | 92 gss_name_t* targ_name, |
93 OM_uint32* lifetime_rec, | 93 OM_uint32* lifetime_rec, |
94 gss_OID* mech_type, | 94 gss_OID* mech_type, |
95 OM_uint32* ctx_flags, | 95 OM_uint32* ctx_flags, |
96 int* locally_initiated, | 96 int* locally_initiated, |
97 int* open) = 0; | 97 int* open) = 0; |
98 | 98 |
99 }; | 99 }; |
100 | 100 |
101 // GSSAPISharedLibrary class is defined here so that unit tests can access it. | 101 // GSSAPISharedLibrary class is defined here so that unit tests can access it. |
102 class NET_TEST GSSAPISharedLibrary : public GSSAPILibrary { | 102 class NET_EXPORT_PRIVATE GSSAPISharedLibrary : public GSSAPILibrary { |
103 public: | 103 public: |
104 // If |gssapi_library_name| is empty, hard-coded default library names are | 104 // If |gssapi_library_name| is empty, hard-coded default library names are |
105 // used. | 105 // used. |
106 explicit GSSAPISharedLibrary(const std::string& gssapi_library_name); | 106 explicit GSSAPISharedLibrary(const std::string& gssapi_library_name); |
107 virtual ~GSSAPISharedLibrary(); | 107 virtual ~GSSAPISharedLibrary(); |
108 | 108 |
109 // GSSAPILibrary methods: | 109 // GSSAPILibrary methods: |
110 virtual bool Init(); | 110 virtual bool Init(); |
111 virtual OM_uint32 import_name( | 111 virtual OM_uint32 import_name( |
112 OM_uint32* minor_status, | 112 OM_uint32* minor_status, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 private: | 208 private: |
209 gss_ctx_id_t security_context_; | 209 gss_ctx_id_t security_context_; |
210 GSSAPILibrary* gssapi_lib_; | 210 GSSAPILibrary* gssapi_lib_; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); | 212 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); |
213 }; | 213 }; |
214 | 214 |
215 | 215 |
216 // TODO(ahendrickson): Share code with HttpAuthSSPI. | 216 // TODO(ahendrickson): Share code with HttpAuthSSPI. |
217 class NET_TEST HttpAuthGSSAPI { | 217 class NET_EXPORT_PRIVATE HttpAuthGSSAPI { |
218 public: | 218 public: |
219 HttpAuthGSSAPI(GSSAPILibrary* library, | 219 HttpAuthGSSAPI(GSSAPILibrary* library, |
220 const std::string& scheme, | 220 const std::string& scheme, |
221 const gss_OID gss_oid); | 221 const gss_OID gss_oid); |
222 ~HttpAuthGSSAPI(); | 222 ~HttpAuthGSSAPI(); |
223 | 223 |
224 bool Init(); | 224 bool Init(); |
225 | 225 |
226 bool NeedsIdentity() const; | 226 bool NeedsIdentity() const; |
227 | 227 |
(...skipping 27 matching lines...) Expand all Loading... |
255 gss_OID gss_oid_; | 255 gss_OID gss_oid_; |
256 GSSAPILibrary* library_; | 256 GSSAPILibrary* library_; |
257 std::string decoded_server_auth_token_; | 257 std::string decoded_server_auth_token_; |
258 ScopedSecurityContext scoped_sec_context_; | 258 ScopedSecurityContext scoped_sec_context_; |
259 bool can_delegate_; | 259 bool can_delegate_; |
260 }; | 260 }; |
261 | 261 |
262 } // namespace net | 262 } // namespace net |
263 | 263 |
264 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 264 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
OLD | NEW |