| 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 "chromeos/login/auth/login_performer.h" | 5 #include "chromeos/login/auth/login_performer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 AuthorizationMode auth_mode) { | 135 AuthorizationMode auth_mode) { |
| 136 auth_mode_ = auth_mode; | 136 auth_mode_ = auth_mode; |
| 137 user_context_ = user_context; | 137 user_context_ = user_context; |
| 138 | 138 |
| 139 if (RunTrustedCheck(base::Bind(&LoginPerformer::DoPerformLogin, | 139 if (RunTrustedCheck(base::Bind(&LoginPerformer::DoPerformLogin, |
| 140 weak_factory_.GetWeakPtr(), | 140 weak_factory_.GetWeakPtr(), |
| 141 user_context_, | 141 user_context_, |
| 142 auth_mode))) { | 142 auth_mode))) { |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 DoPerformLogin(user_context, auth_mode); | 145 DoPerformLogin(user_context_, auth_mode); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void LoginPerformer::DoPerformLogin(const UserContext& user_context, | 148 void LoginPerformer::DoPerformLogin(const UserContext& user_context, |
| 149 AuthorizationMode auth_mode) { | 149 AuthorizationMode auth_mode) { |
| 150 std::string email = gaia::CanonicalizeEmail(user_context.GetUserID()); | 150 std::string email = gaia::CanonicalizeEmail(user_context.GetUserID()); |
| 151 bool wildcard_match = false; | 151 bool wildcard_match = false; |
| 152 if (!IsUserWhitelisted(email, &wildcard_match)) { | 152 if (!IsUserWhitelisted(email, &wildcard_match)) { |
| 153 NotifyWhitelistCheckFailure(); | 153 NotifyWhitelistCheckFailure(); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 171 case AUTH_MODE_INTERNAL: | 171 case AUTH_MODE_INTERNAL: |
| 172 StartAuthentication(); | 172 StartAuthentication(); |
| 173 break; | 173 break; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void LoginPerformer::LoginAsSupervisedUser(const UserContext& user_context) { | 177 void LoginPerformer::LoginAsSupervisedUser(const UserContext& user_context) { |
| 178 DCHECK_EQ(chromeos::login::kSupervisedUserDomain, | 178 DCHECK_EQ(chromeos::login::kSupervisedUserDomain, |
| 179 gaia::ExtractDomainName(user_context.GetUserID())); | 179 gaia::ExtractDomainName(user_context.GetUserID())); |
| 180 | 180 |
| 181 if (RunTrustedCheck(base::Bind(&LoginPerformer::LoginAsSupervisedUser, | 181 user_context_ = user_context; |
| 182 |
| 183 if (RunTrustedCheck(base::Bind(&LoginPerformer::TrustedLoginAsSupervisedUser, |
| 182 weak_factory_.GetWeakPtr(), | 184 weak_factory_.GetWeakPtr(), |
| 183 user_context_))) { | 185 user_context_))) { |
| 184 return; | 186 return; |
| 185 } | 187 } |
| 188 TrustedLoginAsSupervisedUser(user_context_); |
| 189 } |
| 186 | 190 |
| 191 void LoginPerformer::TrustedLoginAsSupervisedUser( |
| 192 const UserContext& user_context) { |
| 187 if (!AreSupervisedUsersAllowed()) { | 193 if (!AreSupervisedUsersAllowed()) { |
| 188 LOG(ERROR) << "Login attempt of supervised user detected."; | 194 LOG(ERROR) << "Login attempt of supervised user detected."; |
| 189 delegate_->WhiteListCheckFailed(user_context.GetUserID()); | 195 delegate_->WhiteListCheckFailed(user_context.GetUserID()); |
| 190 return; | 196 return; |
| 191 } | 197 } |
| 192 | 198 |
| 193 SetupSupervisedUserFlow(user_context.GetUserID()); | 199 SetupSupervisedUserFlow(user_context.GetUserID()); |
| 194 UserContext user_context_copy = TransformSupervisedKey(user_context); | 200 UserContext user_context_copy = TransformSupervisedKey(user_context); |
| 195 | 201 |
| 196 if (UseExtendedAuthenticatorForSupervisedUser(user_context)) { | 202 if (UseExtendedAuthenticatorForSupervisedUser(user_context)) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 } else { | 310 } else { |
| 305 NOTREACHED(); | 311 NOTREACHED(); |
| 306 } | 312 } |
| 307 user_context_.ClearSecrets(); | 313 user_context_.ClearSecrets(); |
| 308 } | 314 } |
| 309 | 315 |
| 310 void LoginPerformer::EnsureAuthenticator() { | 316 void LoginPerformer::EnsureAuthenticator() { |
| 311 authenticator_ = CreateAuthenticator(); | 317 authenticator_ = CreateAuthenticator(); |
| 312 } | 318 } |
| 313 } // namespace chromeos | 319 } // namespace chromeos |
| OLD | NEW |