Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chromeos/login/auth/login_performer.cc

Issue 1494153002: This CL replaces e-mail with AccountId in easy signin code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bugfix in original easy unlock code' Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/login/auth/login_performer.h ('k') | components/proximity_auth/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 weak_factory_.GetWeakPtr(), 123 weak_factory_.GetWeakPtr(),
124 user_context_, 124 user_context_,
125 auth_mode))) { 125 auth_mode))) {
126 return; 126 return;
127 } 127 }
128 DoPerformLogin(user_context_, auth_mode); 128 DoPerformLogin(user_context_, auth_mode);
129 } 129 }
130 130
131 void LoginPerformer::DoPerformLogin(const UserContext& user_context, 131 void LoginPerformer::DoPerformLogin(const UserContext& user_context,
132 AuthorizationMode auth_mode) { 132 AuthorizationMode auth_mode) {
133 const std::string email =
134 gaia::CanonicalizeEmail(user_context.GetAccountId().GetUserEmail());
135 bool wildcard_match = false; 133 bool wildcard_match = false;
136 134
137 if (!IsUserWhitelisted(email, &wildcard_match)) { 135 const AccountId& account_id = user_context.GetAccountId();
136 if (!IsUserWhitelisted(account_id, &wildcard_match)) {
138 NotifyWhitelistCheckFailure(); 137 NotifyWhitelistCheckFailure();
139 return; 138 return;
140 } 139 }
141 140
142 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_UNLOCK) 141 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_UNLOCK)
143 SetupEasyUnlockUserFlow(user_context.GetAccountId().GetUserEmail()); 142 SetupEasyUnlockUserFlow(user_context.GetAccountId());
144 143
145 switch (auth_mode_) { 144 switch (auth_mode_) {
146 case AUTH_MODE_EXTENSION: { 145 case AUTH_MODE_EXTENSION: {
147 RunOnlineWhitelistCheck( 146 RunOnlineWhitelistCheck(
148 email, wildcard_match, user_context.GetRefreshToken(), 147 account_id, wildcard_match, user_context.GetRefreshToken(),
149 base::Bind(&LoginPerformer::StartLoginCompletion, 148 base::Bind(&LoginPerformer::StartLoginCompletion,
150 weak_factory_.GetWeakPtr()), 149 weak_factory_.GetWeakPtr()),
151 base::Bind(&LoginPerformer::NotifyWhitelistCheckFailure, 150 base::Bind(&LoginPerformer::NotifyWhitelistCheckFailure,
152 weak_factory_.GetWeakPtr())); 151 weak_factory_.GetWeakPtr()));
153 break; 152 break;
154 } 153 }
155 case AUTH_MODE_INTERNAL: 154 case AUTH_MODE_INTERNAL:
156 StartAuthentication(); 155 StartAuthentication();
157 break; 156 break;
158 } 157 }
(...skipping 16 matching lines...) Expand all
175 } 174 }
176 175
177 void LoginPerformer::TrustedLoginAsSupervisedUser( 176 void LoginPerformer::TrustedLoginAsSupervisedUser(
178 const UserContext& user_context) { 177 const UserContext& user_context) {
179 if (!AreSupervisedUsersAllowed()) { 178 if (!AreSupervisedUsersAllowed()) {
180 LOG(ERROR) << "Login attempt of supervised user detected."; 179 LOG(ERROR) << "Login attempt of supervised user detected.";
181 delegate_->WhiteListCheckFailed(user_context.GetAccountId().GetUserEmail()); 180 delegate_->WhiteListCheckFailed(user_context.GetAccountId().GetUserEmail());
182 return; 181 return;
183 } 182 }
184 183
185 SetupSupervisedUserFlow(user_context.GetAccountId().GetUserEmail()); 184 SetupSupervisedUserFlow(user_context.GetAccountId());
186 UserContext user_context_copy = TransformSupervisedKey(user_context); 185 UserContext user_context_copy = TransformSupervisedKey(user_context);
187 186
188 if (UseExtendedAuthenticatorForSupervisedUser(user_context)) { 187 if (UseExtendedAuthenticatorForSupervisedUser(user_context)) {
189 EnsureExtendedAuthenticator(); 188 EnsureExtendedAuthenticator();
190 // TODO(antrim) : Replace empty callback with explicit method. 189 // TODO(antrim) : Replace empty callback with explicit method.
191 // http://crbug.com/351268 190 // http://crbug.com/351268
192 task_runner_->PostTask( 191 task_runner_->PostTask(
193 FROM_HERE, 192 FROM_HERE,
194 base::Bind(&ExtendedAuthenticator::AuthenticateToMount, 193 base::Bind(&ExtendedAuthenticator::AuthenticateToMount,
195 extended_authenticator_.get(), 194 extended_authenticator_.get(),
196 user_context_copy, 195 user_context_copy,
197 ExtendedAuthenticator::ResultCallback())); 196 ExtendedAuthenticator::ResultCallback()));
198 197
199 } else { 198 } else {
200 EnsureAuthenticator(); 199 EnsureAuthenticator();
201 task_runner_->PostTask(FROM_HERE, 200 task_runner_->PostTask(FROM_HERE,
202 base::Bind(&Authenticator::LoginAsSupervisedUser, 201 base::Bind(&Authenticator::LoginAsSupervisedUser,
203 authenticator_.get(), 202 authenticator_.get(),
204 user_context_copy)); 203 user_context_copy));
205 } 204 }
206 } 205 }
207 206
208 void LoginPerformer::LoginAsPublicSession(const UserContext& user_context) { 207 void LoginPerformer::LoginAsPublicSession(const UserContext& user_context) {
209 if (!CheckPolicyForUser(user_context.GetAccountId().GetUserEmail())) { 208 if (!CheckPolicyForUser(user_context.GetAccountId())) {
210 DCHECK(delegate_); 209 DCHECK(delegate_);
211 if (delegate_) 210 if (delegate_)
212 delegate_->PolicyLoadFailed(); 211 delegate_->PolicyLoadFailed();
213 return; 212 return;
214 } 213 }
215 214
216 EnsureAuthenticator(); 215 EnsureAuthenticator();
217 task_runner_->PostTask(FROM_HERE, 216 task_runner_->PostTask(FROM_HERE,
218 base::Bind(&Authenticator::LoginAsPublicSession, 217 base::Bind(&Authenticator::LoginAsPublicSession,
219 authenticator_.get(), 218 authenticator_.get(),
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } else { 285 } else {
287 NOTREACHED(); 286 NOTREACHED();
288 } 287 }
289 user_context_.ClearSecrets(); 288 user_context_.ClearSecrets();
290 } 289 }
291 290
292 void LoginPerformer::EnsureAuthenticator() { 291 void LoginPerformer::EnsureAuthenticator() {
293 authenticator_ = CreateAuthenticator(); 292 authenticator_ = CreateAuthenticator();
294 } 293 }
295 } // namespace chromeos 294 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/login_performer.h ('k') | components/proximity_auth/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698