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 user_manager::UserID& user_id = user->GetUserID(); |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 void SAMLOfflineSigninLimiter::ForceOnlineLogin() { | 139 void SAMLOfflineSigninLimiter::ForceOnlineLogin() { |
140 const user_manager::User* user = | 140 const user_manager::User* user = |
141 ProfileHelper::Get()->GetUserByProfile(profile_); | 141 ProfileHelper::Get()->GetUserByProfile(profile_); |
142 if (!user) { | 142 if (!user) { |
143 NOTREACHED(); | 143 NOTREACHED(); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->email(), true); | 147 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->GetUserID(), tru
e); |
148 RecordReauthReason(user->email(), ReauthReason::SAML_REAUTH_POLICY); | 148 RecordReauthReason(user->GetUserID(), ReauthReason::SAML_REAUTH_POLICY); |
149 offline_signin_limit_timer_.reset(); | 149 offline_signin_limit_timer_.reset(); |
150 } | 150 } |
151 | 151 |
152 } // namespace chromeos | 152 } // namespace chromeos |
OLD | NEW |