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

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

Issue 7240021: net: Add NET_API for some linux-only files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2010 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/http/http_auth.h" 15 #include "net/http/http_auth.h"
15 16
16 #define GSS_USE_FUNCTION_POINTERS 17 #define GSS_USE_FUNCTION_POINTERS
17 #include "net/third_party/gssapi/gssapi.h" 18 #include "net/third_party/gssapi/gssapi.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; 22 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X;
22 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; 23 extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE;
23 extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; 24 extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC;
24 25
25 // 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
26 // library. The default implementation attempts to load one of the standard 27 // library. The default implementation attempts to load one of the standard
27 // GSSAPI library implementations, then simply passes the arguments on to 28 // GSSAPI library implementations, then simply passes the arguments on to
28 // that implementation. 29 // that implementation.
29 class GSSAPILibrary { 30 class NET_TEST GSSAPILibrary {
30 public: 31 public:
31 virtual ~GSSAPILibrary() {} 32 virtual ~GSSAPILibrary() {}
32 33
33 // Initializes the library, including any necessary dynamic libraries. 34 // Initializes the library, including any necessary dynamic libraries.
34 // This is done separately from construction (which happens at startup time) 35 // This is done separately from construction (which happens at startup time)
35 // in order to delay work until the class is actually needed. 36 // in order to delay work until the class is actually needed.
36 virtual bool Init() = 0; 37 virtual bool Init() = 0;
37 38
38 // These methods match the ones in the GSSAPI library. 39 // These methods match the ones in the GSSAPI library.
39 virtual OM_uint32 import_name( 40 virtual OM_uint32 import_name(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 gss_name_t* targ_name, 92 gss_name_t* targ_name,
92 OM_uint32* lifetime_rec, 93 OM_uint32* lifetime_rec,
93 gss_OID* mech_type, 94 gss_OID* mech_type,
94 OM_uint32* ctx_flags, 95 OM_uint32* ctx_flags,
95 int* locally_initiated, 96 int* locally_initiated,
96 int* open) = 0; 97 int* open) = 0;
97 98
98 }; 99 };
99 100
100 // 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.
101 class GSSAPISharedLibrary : public GSSAPILibrary { 102 class NET_TEST GSSAPISharedLibrary : public GSSAPILibrary {
102 public: 103 public:
103 // 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
104 // used. 105 // used.
105 explicit GSSAPISharedLibrary(const std::string& gssapi_library_name); 106 explicit GSSAPISharedLibrary(const std::string& gssapi_library_name);
106 virtual ~GSSAPISharedLibrary(); 107 virtual ~GSSAPISharedLibrary();
107 108
108 // GSSAPILibrary methods: 109 // GSSAPILibrary methods:
109 virtual bool Init(); 110 virtual bool Init();
110 virtual OM_uint32 import_name( 111 virtual OM_uint32 import_name(
111 OM_uint32* minor_status, 112 OM_uint32* minor_status,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 207
207 private: 208 private:
208 gss_ctx_id_t security_context_; 209 gss_ctx_id_t security_context_;
209 GSSAPILibrary* gssapi_lib_; 210 GSSAPILibrary* gssapi_lib_;
210 211
211 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext); 212 DISALLOW_COPY_AND_ASSIGN(ScopedSecurityContext);
212 }; 213 };
213 214
214 215
215 // TODO(ahendrickson): Share code with HttpAuthSSPI. 216 // TODO(ahendrickson): Share code with HttpAuthSSPI.
216 class HttpAuthGSSAPI { 217 class NET_TEST HttpAuthGSSAPI {
217 public: 218 public:
218 HttpAuthGSSAPI(GSSAPILibrary* library, 219 HttpAuthGSSAPI(GSSAPILibrary* library,
219 const std::string& scheme, 220 const std::string& scheme,
220 const gss_OID gss_oid); 221 const gss_OID gss_oid);
221 ~HttpAuthGSSAPI(); 222 ~HttpAuthGSSAPI();
222 223
223 bool Init(); 224 bool Init();
224 225
225 bool NeedsIdentity() const; 226 bool NeedsIdentity() const;
226 227
(...skipping 27 matching lines...) Expand all
254 gss_OID gss_oid_; 255 gss_OID gss_oid_;
255 GSSAPILibrary* library_; 256 GSSAPILibrary* library_;
256 std::string decoded_server_auth_token_; 257 std::string decoded_server_auth_token_;
257 ScopedSecurityContext scoped_sec_context_; 258 ScopedSecurityContext scoped_sec_context_;
258 bool can_delegate_; 259 bool can_delegate_;
259 }; 260 };
260 261
261 } // namespace net 262 } // namespace net
262 263
263 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ 264 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_
OLDNEW
« base/base_api.h ('K') | « net/base/net_api.h ('k') | net/http/http_auth_handler_ntlm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698