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

Unified Diff: net/http/http_auth_handler_factory.h

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move //base/prefs references out of net - part 1. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_auth_handler_factory.h
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h
index 1261bedd567645f3e6c5fc3a5e214f2652569297..5298baa18b06d3a722951b1c28878637942a113a 100644
--- a/net/http/http_auth_handler_factory.h
+++ b/net/http/http_auth_handler_factory.h
@@ -19,6 +19,7 @@ class GURL;
namespace net {
class BoundNetLog;
+class HttpAuthPreferences;
class HostResolver;
class HttpAuthChallengeTokenizer;
class HttpAuthHandler;
@@ -34,18 +35,20 @@ class NET_EXPORT HttpAuthHandlerFactory {
CREATE_PREEMPTIVE, // Create a handler preemptively.
};
- HttpAuthHandlerFactory() : url_security_manager_(NULL) {}
+ HttpAuthHandlerFactory() : http_auth_preferences_(NULL) {}
virtual ~HttpAuthHandlerFactory() {}
- // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL
- // security manager, and the URL security manager should outlive this object.
- void set_url_security_manager(URLSecurityManager* url_security_manager) {
- url_security_manager_ = url_security_manager;
+ // Sets the source of the HTTP authentication preferences.
+ // HttpAuthHandlerFactory doesn't own the preferences, and the
+ // HttpAuthPreference object should outlive the factory and any handlers it
+ // creates.
+ void set_http_auth_preferences(HttpAuthPreferences* http_auth_preferences) {
+ http_auth_preferences_ = http_auth_preferences;
}
// Retrieves the associated URL security manager.
- URLSecurityManager* url_security_manager() {
- return url_security_manager_;
+ HttpAuthPreferences* http_auth_preferences() {
+ return http_auth_preferences_;
}
// Creates an HttpAuthHandler object based on the authentication
@@ -106,6 +109,23 @@ class NET_EXPORT HttpAuthHandlerFactory {
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler);
+ // For appropriate factories |SetNegotiateDisableCnameLookup()| sets whether
+ // the auth handlers generated by this factory should skip looking up the
+ // canonical DNS name of the the host that they are authenticating to when
+ // generating the SPN. The default value is false.
+ virtual void SetNegotiateDisableCnameLookup(bool disable_cname_lookup) {}
asanka 2015/11/20 15:32:09 Why have individual setters? Wouldn't the callers
aberent 2015/11/23 16:34:01 Done.
+
+ // Sets the android account type to use, if relevant for this authenticator
+ virtual void SetAndroidAuthNegotiateAccountType(
+ const std::string& account_type) {}
+
+ // For appropriate factories |SetNegotiateEnablePort()| get/set whether the
+ // auth handlers
+ // generated by this factory should include the port number of the server
+ // they are authenticating to when constructing a Kerberos SPN. The default
+ // value is false.
+ virtual void SetNegotiateEnablePort(bool use_port) {}
+
// Creates a standard HttpAuthHandlerRegistryFactory. The caller is
// responsible for deleting the factory.
// The default factory supports Basic, Digest, NTLM, and Negotiate schemes.
@@ -119,8 +139,8 @@ class NET_EXPORT HttpAuthHandlerFactory {
HostResolver* resolver);
private:
- // The URL security manager
- URLSecurityManager* url_security_manager_;
+ // The preferences for HTTP authentication.
+ HttpAuthPreferences* http_auth_preferences_;
DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerFactory);
};
@@ -133,9 +153,9 @@ class NET_EXPORT HttpAuthHandlerRegistryFactory
HttpAuthHandlerRegistryFactory();
~HttpAuthHandlerRegistryFactory() override;
- // Sets an URL security manager into the factory associated with |scheme|.
- void SetURLSecurityManager(const std::string& scheme,
- URLSecurityManager* url_security_manager);
+ // Sets the preferences into the factory associated with |scheme|.
+ void SetHttpAuthPreferences(const std::string& scheme,
+ HttpAuthPreferences* prefs);
// Registers a |factory| that will be used for a particular HTTP
// authentication scheme such as Basic, Digest, or Negotiate.
@@ -157,37 +177,21 @@ class NET_EXPORT HttpAuthHandlerRegistryFactory
// Creates an HttpAuthHandlerRegistryFactory.
//
- // |supported_schemes| is a list of authentication schemes. Valid values
- // include "basic", "digest", "ntlm", and "negotiate", where case matters.
- //
- // |security_manager| is used by the NTLM and Negotiate authenticators
- // to determine which servers Integrated Authentication can be used with. If
- // NULL, Integrated Authentication will not be used with any server.
+ // |prefs| is a pointer to the (single) authentication preferences object.
+ // That object tracks preference, and hence policy, updates relevant to HTTP
+ // authentication, and provides the current values of the preferences.
//
// |host_resolver| is used by the Negotiate authentication handler to perform
// CNAME lookups to generate a Kerberos SPN for the server. If the "negotiate"
// scheme is used and |negotiate_disable_cname_lookup| is false,
// |host_resolver| must not be NULL.
- //
- // |gssapi_library_name| specifies the name of the GSSAPI library that will
- // be loaded on Posix platforms other than Android. |gssapi_library_name| is
- // ignored on Android and Windows.
- //
- // |auth_android_negotiate_account_type| is an Android account type, used to
- // find the appropriate authenticator service on Android. It is ignored on
- // non-Android platforms.
- //
- // |negotiate_disable_cname_lookup| and |negotiate_enable_port| both control
- // how Negotiate does SPN generation, by default these should be false.
- static HttpAuthHandlerRegistryFactory* Create(
- const std::vector<std::string>& supported_schemes,
- URLSecurityManager* security_manager,
- HostResolver* host_resolver,
- const std::string& gssapi_library_name,
- const std::string& auth_android_negotiate_account_type,
- bool negotiate_disable_cname_lookup,
- bool negotiate_enable_port);
-
+ static scoped_ptr<HttpAuthHandlerRegistryFactory> Create(
+ HttpAuthPreferences* prefs,
+ HostResolver* host_resolver);
+#if defined(OS_ANDROID)
+ void SetAndroidAuthNegotiateAccountType(
+ const std::string& account_type) override;
+#endif
// Creates an auth handler by dispatching out to the registered factories
// based on the first token in |challenge|.
int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge,

Powered by Google App Engine
This is Rietveld 408576698