summaryrefslogtreecommitdiffstats
path: root/chrome/browser/login_prompt.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 06:43:48 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 06:43:48 +0000
commit515838ce76cb8bec7f51f6143cac74f113e247ad (patch)
tree71b70d594974310b35d1c8f7843aeda5717c044b /chrome/browser/login_prompt.cc
parent92352a66515fd9a01f538529356ad45870109f28 (diff)
downloadchromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.zip
chromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.tar.gz
chromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.tar.bz2
post-winhttp cleanup: refactor net/base/auth_cache into net/ftp/ftp_auth_cache.
Also moves AuthCache::HttpKey() --> GetSignonRealmKey(). Review URL: http://codereview.chromium.org/18218 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/login_prompt.cc')
-rw-r--r--chrome/browser/login_prompt.cc36
1 files changed, 31 insertions, 5 deletions
diff --git a/chrome/browser/login_prompt.cc b/chrome/browser/login_prompt.cc
index 377753f..5ce0638 100644
--- a/chrome/browser/login_prompt.cc
+++ b/chrome/browser/login_prompt.cc
@@ -43,6 +43,35 @@ static void ResetLoginHandlerForRequest(URLRequest* request) {
}
// ----------------------------------------------------------------------------
+// LoginHandler
+
+// Get the signon_realm under which this auth info should be stored.
+//
+// The format of the signon_realm for proxy auth is:
+// proxy-host/auth-realm
+// The format of the signon_realm for server auth is:
+// url-scheme://url-host[:url-port]/auth-realm
+//
+// Be careful when changing this function, since you could make existing
+// saved logins un-retrievable.
+
+// static
+std::string LoginHandler::GetSignonRealm(const GURL& url,
+ const net::AuthChallengeInfo& auth_info) {
+ std::string signon_realm;
+ if (auth_info.is_proxy) {
+ signon_realm = WideToASCII(auth_info.host);
+ signon_realm.append("/");
+ } else {
+ // Take scheme, host, and port from the url.
+ signon_realm = url.GetOrigin().spec();
+ // This ends with a "/".
+ }
+ signon_realm.append(WideToUTF8(auth_info.realm));
+ return signon_realm;
+}
+
+// ----------------------------------------------------------------------------
// LoginHandlerImpl
// This class simply forwards the authentication from the LoginView (on
@@ -358,11 +387,8 @@ class LoginDialogTask : public Task {
dialog_form.scheme = PasswordForm::SCHEME_OTHER;
}
dialog_form.origin = origin_url;
- // TODO(timsteele): Shouldn't depend on HttpKey since a change to the
- // format would result in not being able to retrieve existing logins
- // for a site. Refactor HttpKey behavior to be more reusable.
- dialog_form.signon_realm =
- net::AuthCache::HttpKey(dialog_form.origin, *auth_info_);
+ dialog_form.signon_realm = LoginHandler::GetSignonRealm(dialog_form.origin,
+ *auth_info_);
password_manager_input->push_back(dialog_form);
// Set the password form for the handler (by copy).
handler_->set_password_form(dialog_form);