Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" | 5 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SAMLOfflineSigninLimiter::SignedIn(UserContext::AuthFlow auth_flow) { | 40 void SAMLOfflineSigninLimiter::SignedIn(UserContext::AuthFlow auth_flow) { |
| 41 PrefService* prefs = profile_->GetPrefs(); | 41 PrefService* prefs = profile_->GetPrefs(); |
| 42 const user_manager::User* user = | 42 const user_manager::User* user = |
| 43 ProfileHelper::Get()->GetUserByProfile(profile_); | 43 ProfileHelper::Get()->GetUserByProfile(profile_); |
| 44 if (!user) { | 44 if (!user) { |
| 45 NOTREACHED(); | 45 NOTREACHED(); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 const std::string& user_id = user->email(); | 48 const AccountId user_id = user->GetUserID(); |
|
achuithb
2015/10/23 00:08:50
account_id
Alexander Alekseev
2015/10/23 09:11:21
Done.
| |
| 49 | 49 |
| 50 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML) { | 50 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML) { |
| 51 // The user went through online authentication and GAIA did not redirect to | 51 // The user went through online authentication and GAIA did not redirect to |
| 52 // a SAML IdP. No limit applies in this case. Clear the time of last login | 52 // a SAML IdP. No limit applies in this case. Clear the time of last login |
| 53 // with SAML and the flag enforcing online login, then return. | 53 // with SAML and the flag enforcing online login, then return. |
| 54 prefs->ClearPref(prefs::kSAMLLastGAIASignInTime); | 54 prefs->ClearPref(prefs::kSAMLLastGAIASignInTime); |
| 55 user_manager::UserManager::Get()->SaveForceOnlineSignin(user_id, false); | 55 user_manager::UserManager::Get()->SaveForceOnlineSignin(user_id, false); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SAMLOfflineSigninLimiter::ForceOnlineLogin() { | 138 void SAMLOfflineSigninLimiter::ForceOnlineLogin() { |
| 139 const user_manager::User* user = | 139 const user_manager::User* user = |
| 140 ProfileHelper::Get()->GetUserByProfile(profile_); | 140 ProfileHelper::Get()->GetUserByProfile(profile_); |
| 141 if (!user) { | 141 if (!user) { |
| 142 NOTREACHED(); | 142 NOTREACHED(); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->email(), true); | 146 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->GetUserID(), |
| 147 RecordReauthReason(user->email(), ReauthReason::SAML_REAUTH_POLICY); | 147 true); |
| 148 RecordReauthReason(user->GetUserID(), ReauthReason::SAML_REAUTH_POLICY); | |
| 148 offline_signin_limit_timer_.reset(); | 149 offline_signin_limit_timer_.reset(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |