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

Side by Side Diff: chrome/browser/chromeos/enrollment_dialog_view.cc

Issue 2828713002: Enable client certificate patterns in device ONC policy (Closed)
Patch Set: Clean up. Created 3 years, 8 months 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
OLDNEW
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 "chrome/browser/chromeos/enrollment_dialog_view.h" 5 #include "chrome/browser/chromeos/enrollment_dialog_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 const NetworkState* network = 263 const NetworkState* network =
264 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( 264 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid(
265 network_id); 265 network_id);
266 if (!network) { 266 if (!network) {
267 NET_LOG_ERROR("Enrolling Unknown network", network_id); 267 NET_LOG_ERROR("Enrolling Unknown network", network_id);
268 return false; 268 return false;
269 } 269 }
270 Browser* browser = chrome::FindBrowserWithWindow(owning_window); 270 Browser* browser = chrome::FindBrowserWithWindow(owning_window);
271 Profile* profile = 271 Profile* profile =
272 browser ? browser->profile() : ProfileManager::GetPrimaryUserProfile(); 272 browser ? browser->profile() : ProfileManager::GetPrimaryUserProfile();
273 if (chromeos::ProfileHelper::IsSigninProfile(profile))
emaxx 2017/04/24 21:23:13 So what about other types of sessions - aren't we
pmarko 2017/04/25 12:10:02 Oh yes, good point. I've thought about getting the
274 return false;
stevenjb 2017/04/24 15:53:59 Could you add a comment for this exit?
pmarko 2017/04/25 12:10:02 Done. (on the new method - if you'd like an explic
273 std::string username_hash = ProfileHelper::GetUserIdHashFromProfile(profile); 275 std::string username_hash = ProfileHelper::GetUserIdHashFromProfile(profile);
274 276
275 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; 277 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
276 const base::DictionaryValue* policy = 278 const base::DictionaryValue* policy =
277 NetworkHandler::Get() 279 NetworkHandler::Get()
278 ->managed_network_configuration_handler() 280 ->managed_network_configuration_handler()
279 ->FindPolicyByGUID(username_hash, network_id, &onc_source); 281 ->FindPolicyByGUID(username_hash, network_id, &onc_source);
280 282
281 // We skip certificate patterns for device policy ONC so that an unmanaged 283 if (!policy)
282 // user can't get to the place where a cert is presented for them
283 // involuntarily.
284 if (!policy || onc_source == onc::ONC_SOURCE_DEVICE_POLICY)
285 return false; 284 return false;
286 285
287 client_cert::ClientCertConfig cert_config; 286 client_cert::ClientCertConfig cert_config;
288 OncToClientCertConfig(*policy, &cert_config); 287 OncToClientCertConfig(onc_source, *policy, &cert_config);
289 288
290 if (cert_config.client_cert_type != onc::client_cert::kPattern) 289 if (cert_config.client_cert_type != onc::client_cert::kPattern)
291 return false; 290 return false;
292 291
293 if (cert_config.pattern.Empty()) 292 if (cert_config.pattern.Empty())
294 NET_LOG_ERROR("Certificate pattern is empty", network_id); 293 NET_LOG_ERROR("Certificate pattern is empty", network_id);
295 294
296 if (cert_config.pattern.enrollment_uri_list().empty()) { 295 if (cert_config.pattern.enrollment_uri_list().empty()) {
297 NET_LOG_EVENT("No enrollment URIs", network_id); 296 NET_LOG_EVENT("No enrollment URIs", network_id);
298 return false; 297 return false;
299 } 298 }
300 299
301 NET_LOG_USER("Enrolling", network_id); 300 NET_LOG_USER("Enrolling", network_id);
302 301
303 DialogEnrollmentDelegate* enrollment = 302 DialogEnrollmentDelegate* enrollment =
304 new DialogEnrollmentDelegate(owning_window, network->name(), profile); 303 new DialogEnrollmentDelegate(owning_window, network->name(), profile);
305 return enrollment->Enroll(cert_config.pattern.enrollment_uri_list(), 304 return enrollment->Enroll(cert_config.pattern.enrollment_uri_list(),
306 base::Bind(&EnrollmentComplete, network_id)); 305 base::Bind(&EnrollmentComplete, network_id));
307 } 306 }
308 307
309 } // namespace enrollment 308 } // namespace enrollment
310 309
311 } // namespace chromeos 310 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698