OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "google_apis/gaia/gaia_auth_util.h" | 5 #include "google_apis/gaia/gaia_auth_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "google_apis/gaia/gaia_urls.h" |
| 13 #include "googleurl/src/gurl.h" |
12 | 14 |
13 namespace gaia { | 15 namespace gaia { |
14 | 16 |
15 namespace { | 17 namespace { |
16 const char kGmailDomain[] = "gmail.com"; | 18 const char kGmailDomain[] = "gmail.com"; |
17 } | 19 } |
18 | 20 |
19 std::string CanonicalizeEmail(const std::string& email_address) { | 21 std::string CanonicalizeEmail(const std::string& email_address) { |
20 std::vector<std::string> parts; | 22 std::vector<std::string> parts; |
21 char at = '@'; | 23 char at = '@'; |
(...skipping 29 matching lines...) Expand all Loading... |
51 // First canonicalize which will also verify we have proper domain part. | 53 // First canonicalize which will also verify we have proper domain part. |
52 std::string email = CanonicalizeEmail(email_address); | 54 std::string email = CanonicalizeEmail(email_address); |
53 size_t separator_pos = email.find('@'); | 55 size_t separator_pos = email.find('@'); |
54 if (separator_pos != email.npos && separator_pos < email.length() - 1) | 56 if (separator_pos != email.npos && separator_pos < email.length() - 1) |
55 return email.substr(separator_pos + 1); | 57 return email.substr(separator_pos + 1); |
56 else | 58 else |
57 NOTREACHED() << "Not a proper email address: " << email; | 59 NOTREACHED() << "Not a proper email address: " << email; |
58 return std::string(); | 60 return std::string(); |
59 } | 61 } |
60 | 62 |
| 63 bool IsGaiaSignonRealm(const GURL& url) { |
| 64 if (!url.SchemeIsSecure()) |
| 65 return false; |
| 66 |
| 67 // Also check "https://www.google.com" to support old style dasher logins. |
| 68 return url == GURL(GaiaUrls::GetInstance()->gaia_origin_url()) || |
| 69 url == GURL("https://www.google.com/"); |
| 70 } |
| 71 |
61 } // namespace gaia | 72 } // namespace gaia |
OLD | NEW |