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

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

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a nit I had missed. Created 5 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
OLDNEW
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_NEGOTIATE_H_ 5 #ifndef NET_ANDROID_HTTP_AUTH_HANDLER_NEGOTIATE_H_
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ 6 #define NET_ANDROID_HTTP_AUTH_HANDLER_NEGOTIATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "net/base/address_list.h" 11 #include "net/base/address_list.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/http/http_auth_handler.h" 13 #include "net/http/http_auth_handler.h"
14 #include "net/http/http_auth_handler_factory.h" 14 #include "net/http/http_auth_handler_factory.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include "net/http/http_auth_sspi_win.h" 17 #include "net/http/http_auth_sspi_win.h"
18 #elif defined(OS_ANDROID)
Bernhard Bauer 2015/06/10 17:11:03 I think I would rather put these into alphabetic o
aberent 2015/06/15 15:52:20 Done.
19 #include "net/android/http_android_auth_negotiate.h"
18 #elif defined(OS_POSIX) 20 #elif defined(OS_POSIX)
19 #include "net/http/http_auth_gssapi_posix.h" 21 #include "net/http/http_auth_gssapi_posix.h"
20 #endif 22 #endif
21 23
22 namespace net { 24 namespace net {
23 25
24 class HostResolver; 26 class HostResolver;
25 class SingleRequestHostResolver; 27 class SingleRequestHostResolver;
26 class URLSecurityManager; 28 class URLSecurityManager;
27 29
28 // Handler for WWW-Authenticate: Negotiate protocol. 30 // Handler for WWW-Authenticate: Negotiate protocol.
29 // 31 //
30 // See http://tools.ietf.org/html/rfc4178 and http://tools.ietf.org/html/rfc4559 32 // See http://tools.ietf.org/html/rfc4178 and http://tools.ietf.org/html/rfc4559
31 // for more information about the protocol. 33 // for more information about the protocol.
32 34
33 class NET_EXPORT_PRIVATE HttpAuthHandlerNegotiate : public HttpAuthHandler { 35 class NET_EXPORT_PRIVATE HttpAuthHandlerNegotiate : public HttpAuthHandler {
34 public: 36 public:
35 #if defined(OS_WIN) 37 #if defined(OS_ANDROID)
38 typedef net::android::AndroidAuthNegotiate AuthSystem;
39 #elif defined(OS_WIN)
36 typedef SSPILibrary AuthLibrary; 40 typedef SSPILibrary AuthLibrary;
37 typedef HttpAuthSSPI AuthSystem; 41 typedef HttpAuthSSPI AuthSystem;
38 #elif defined(OS_POSIX) 42 #elif defined(OS_POSIX)
39 typedef GSSAPILibrary AuthLibrary; 43 typedef GSSAPILibrary AuthLibrary;
40 typedef HttpAuthGSSAPI AuthSystem; 44 typedef HttpAuthGSSAPI AuthSystem;
41 #endif 45 #endif
42 46
43 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { 47 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory {
44 public: 48 public:
45 Factory(); 49 Factory();
(...skipping 10 matching lines...) Expand all
56 60
57 // |use_port()| and |set_use_port()| get/set whether the auth handlers 61 // |use_port()| and |set_use_port()| get/set whether the auth handlers
58 // generated by this factory should include the port number of the server 62 // generated by this factory should include the port number of the server
59 // they are authenticating to when constructing a Kerberos SPN. The default 63 // they are authenticating to when constructing a Kerberos SPN. The default
60 // value is false. 64 // value is false.
61 bool use_port() const { return use_port_; } 65 bool use_port() const { return use_port_; }
62 void set_use_port(bool use_port) { use_port_ = use_port; } 66 void set_use_port(bool use_port) { use_port_ = use_port; }
63 67
64 void set_host_resolver(HostResolver* host_resolver); 68 void set_host_resolver(HostResolver* host_resolver);
65 69
70 #if defined(OS_ANDROID)
71 // Sets the account type to use for authentication
72 void set_account_type(const std::string& account_type) {
73 account_type_ = account_type;
74 }
75 #else
cbentzel 2015/06/11 20:51:43 Should do #endif/#if defined() here - set_account_
aberent 2015/06/15 15:52:20 Done.
66 // Sets the system library to use, thereby assuming ownership of 76 // Sets the system library to use, thereby assuming ownership of
67 // |auth_library|. 77 // |auth_library|.
68 void set_library(AuthLibrary* auth_library) { 78 void set_library(AuthLibrary* auth_library) {
69 auth_library_.reset(auth_library); 79 auth_library_.reset(auth_library);
70 } 80 }
81 #endif
71 82
72 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, 83 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge,
73 HttpAuth::Target target, 84 HttpAuth::Target target,
74 const GURL& origin, 85 const GURL& origin,
75 CreateReason reason, 86 CreateReason reason,
76 int digest_nonce_count, 87 int digest_nonce_count,
77 const BoundNetLog& net_log, 88 const BoundNetLog& net_log,
78 scoped_ptr<HttpAuthHandler>* handler) override; 89 scoped_ptr<HttpAuthHandler>* handler) override;
79 90
80 private: 91 private:
81 bool disable_cname_lookup_; 92 bool disable_cname_lookup_;
82 bool use_port_; 93 bool use_port_;
83 HostResolver* resolver_; 94 HostResolver* resolver_;
84 #if defined(OS_WIN) 95 #if defined(OS_WIN)
85 ULONG max_token_length_; 96 ULONG max_token_length_;
86 bool first_creation_; 97 bool first_creation_;
87 #endif 98 #endif
88 bool is_unsupported_; 99 bool is_unsupported_;
100 #if defined(OS_ANDROID)
101 std::string account_type_;
102 #else
89 scoped_ptr<AuthLibrary> auth_library_; 103 scoped_ptr<AuthLibrary> auth_library_;
104 #endif
90 }; 105 };
91 106
92 HttpAuthHandlerNegotiate(AuthLibrary* sspi_library, 107 HttpAuthHandlerNegotiate(
108 #if defined(OS_ANDROID)
109 std::string account_type,
110 #else
111 AuthLibrary* sspi_library,
112 #endif
93 #if defined(OS_WIN) 113 #if defined(OS_WIN)
94 ULONG max_token_length, 114 ULONG max_token_length,
95 #endif 115 #endif
96 URLSecurityManager* url_security_manager, 116 URLSecurityManager* url_security_manager,
97 HostResolver* host_resolver, 117 HostResolver* host_resolver,
98 bool disable_cname_lookup, 118 bool disable_cname_lookup,
99 bool use_port); 119 bool use_port);
100 120
101 ~HttpAuthHandlerNegotiate() override; 121 ~HttpAuthHandlerNegotiate() override;
102 122
103 // These are public for unit tests 123 // These are public for unit tests
104 std::string CreateSPN(const AddressList& address_list, const GURL& orign); 124 std::string CreateSPN(const AddressList& address_list, const GURL& orign);
105 const std::string& spn() const { return spn_; } 125 const std::string& spn() const { return spn_; }
106 126
107 // HttpAuthHandler: 127 // HttpAuthHandler:
108 HttpAuth::AuthorizationResult HandleAnotherChallenge( 128 HttpAuth::AuthorizationResult HandleAnotherChallenge(
109 HttpAuthChallengeTokenizer* challenge) override; 129 HttpAuthChallengeTokenizer* challenge) override;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 CompletionCallback callback_; 177 CompletionCallback callback_;
158 std::string* auth_token_; 178 std::string* auth_token_;
159 179
160 State next_state_; 180 State next_state_;
161 181
162 const URLSecurityManager* url_security_manager_; 182 const URLSecurityManager* url_security_manager_;
163 }; 183 };
164 184
165 } // namespace net 185 } // namespace net
166 186
167 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ 187 #endif // NET_ANDROID_HTTP_AUTH_HANDLER_NEGOTIATE_H_
cbentzel 2015/06/11 20:51:43 Nit: Move back to NET_HTTP_HTTP (and the same for
aberent 2015/06/15 15:52:20 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698