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

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

Issue 1393693002: [net/http auth] Split HttpAuthHandler creation from initialization. Base URL: https://chromium.googlesource.com/chromium/src.git@rename-auth-handler-methods
Patch Set: Created 5 years, 2 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
« no previous file with comments | « net/http/http_auth_handler_negotiate_unittest.cc ('k') | net/http/http_auth_handler_ntlm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_NTLM_H_ 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 // This contains the portable and the SSPI implementations for NTLM. 10 // This contains the portable and the SSPI implementations for NTLM.
(...skipping 23 matching lines...) Expand all
34 class URLSecurityManager; 34 class URLSecurityManager;
35 35
36 // Code for handling HTTP NTLM authentication. 36 // Code for handling HTTP NTLM authentication.
37 class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler { 37 class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler {
38 public: 38 public:
39 class Factory : public HttpAuthHandlerFactory { 39 class Factory : public HttpAuthHandlerFactory {
40 public: 40 public:
41 Factory(); 41 Factory();
42 ~Factory() override; 42 ~Factory() override;
43 43
44 int CreateAuthHandler(const HttpAuthChallengeTokenizer& challenge, 44 // HttpAuthHandlerFactory
45 HttpAuth::Target target, 45 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme(
46 const GURL& origin, 46 const std::string& scheme) override;
47 CreateReason reason, 47 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler(
48 int digest_nonce_count, 48 HttpAuthCache::Entry* cache_entry,
49 const BoundNetLog& net_log, 49 const HttpAuthChallengeTokenizer& tokenizer,
50 scoped_ptr<HttpAuthHandler>* handler) override; 50 HttpAuth::Target target,
51 const BoundNetLog& net_log) override;
51 #if defined(NTLM_SSPI) 52 #if defined(NTLM_SSPI)
52 // Set the SSPILibrary to use. Typically the only callers which need to use 53 // Set the SSPILibrary to use. Typically the only callers which need to use
53 // this are unit tests which pass in a mocked-out version of the SSPI 54 // this are unit tests which pass in a mocked-out version of the SSPI
54 // library. After the call |sspi_library| will be owned by this Factory and 55 // library. After the call |sspi_library| will be owned by this Factory and
55 // will be destroyed when the Factory is destroyed. 56 // will be destroyed when the Factory is destroyed.
56 void set_sspi_library(SSPILibrary* sspi_library) { 57 void set_sspi_library(SSPILibrary* sspi_library) {
57 sspi_library_.reset(sspi_library); 58 sspi_library_.reset(sspi_library);
58 } 59 }
59 #endif // defined(NTLM_SSPI) 60 #endif // defined(NTLM_SSPI)
60 private: 61 private:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 }; 95 };
95 #endif 96 #endif
96 97
97 #if defined(NTLM_PORTABLE) 98 #if defined(NTLM_PORTABLE)
98 HttpAuthHandlerNTLM(); 99 HttpAuthHandlerNTLM();
99 #endif 100 #endif
100 #if defined(NTLM_SSPI) 101 #if defined(NTLM_SSPI)
101 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, 102 HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length,
102 URLSecurityManager* url_security_manager); 103 URLSecurityManager* url_security_manager);
103 #endif 104 #endif
105 ~HttpAuthHandlerNTLM() override;
104 106
107 // HttpAuthHandler
105 bool NeedsIdentity() override; 108 bool NeedsIdentity() override;
106
107 bool AllowsDefaultCredentials() override; 109 bool AllowsDefaultCredentials() override;
108
109 HttpAuth::AuthorizationResult HandleAnotherChallenge( 110 HttpAuth::AuthorizationResult HandleAnotherChallenge(
110 const HttpAuthChallengeTokenizer& challenge) override; 111 const HttpAuthChallengeTokenizer& challenge) override;
111 112
112 protected: 113 protected:
113 // This function acquires a credentials handle in the SSPI implementation. 114 // This function acquires a credentials handle in the SSPI implementation.
114 // It does nothing in the portable implementation. 115 // It does nothing in the portable implementation.
115 int InitializeBeforeFirstChallenge(); 116 int InitializeBeforeFirstChallenge();
116 117
118 // HttpAuthHandler
117 int Init(const HttpAuthChallengeTokenizer& tok) override; 119 int Init(const HttpAuthChallengeTokenizer& tok) override;
118
119 int GenerateAuthTokenImpl(const AuthCredentials* credentials, 120 int GenerateAuthTokenImpl(const AuthCredentials* credentials,
120 const HttpRequestInfo& request, 121 const HttpRequestInfo& request,
121 const CompletionCallback& callback, 122 const CompletionCallback& callback,
122 std::string* auth_token) override; 123 std::string* auth_token) override;
123 124
124 private: 125 private:
125 ~HttpAuthHandlerNTLM() override;
126
127 #if defined(NTLM_PORTABLE) 126 #if defined(NTLM_PORTABLE)
128 // For unit tests to override the GenerateRandom and GetHostName functions. 127 // For unit tests to override the GenerateRandom and GetHostName functions.
129 // Returns the old function. 128 // Returns the old function.
130 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc); 129 static GenerateRandomProc SetGenerateRandomProc(GenerateRandomProc proc);
131 static HostNameProc SetHostNameProc(HostNameProc proc); 130 static HostNameProc SetHostNameProc(HostNameProc proc);
132 #endif 131 #endif
133 132
134 // Parse the challenge, saving the results into this instance. 133 // Parse the challenge, saving the results into this instance.
135 HttpAuth::AuthorizationResult ParseChallenge( 134 HttpAuth::AuthorizationResult ParseChallenge(
136 const HttpAuthChallengeTokenizer& tok, 135 const HttpAuthChallengeTokenizer& tok,
(...skipping 26 matching lines...) Expand all
163 std::string auth_data_; 162 std::string auth_data_;
164 163
165 #if defined(NTLM_SSPI) 164 #if defined(NTLM_SSPI)
166 URLSecurityManager* url_security_manager_; 165 URLSecurityManager* url_security_manager_;
167 #endif 166 #endif
168 }; 167 };
169 168
170 } // namespace net 169 } // namespace net
171 170
172 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_ 171 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NTLM_H_
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_negotiate_unittest.cc ('k') | net/http/http_auth_handler_ntlm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698