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

Side by Side Diff: chrome/browser/chromeos/login/managed/supervised_user_authentication.cc

Issue 290483003: Tame the proliferation of UserContext constructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/managed/supervised_user_authentication.h " 5 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h "
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 holder.GetStringWithoutPathExpansion(kSalt, &salt); 118 holder.GetStringWithoutPathExpansion(kSalt, &salt);
119 DCHECK(!salt.empty()); 119 DCHECK(!salt.empty());
120 return BuildPasswordForHashWithSaltSchema(salt, password); 120 return BuildPasswordForHashWithSaltSchema(salt, password);
121 } 121 }
122 NOTREACHED(); 122 NOTREACHED();
123 return password; 123 return password;
124 } 124 }
125 125
126 UserContext SupervisedUserAuthentication::TransformPasswordInContext( 126 UserContext SupervisedUserAuthentication::TransformPasswordInContext(
127 const UserContext& context) { 127 const UserContext& context) {
128 UserContext result; 128 UserContext result = context;
129 result.CopyFrom(context);
130 int user_schema = GetPasswordSchema(context.GetUserID()); 129 int user_schema = GetPasswordSchema(context.GetUserID());
131 if (user_schema == SCHEMA_PLAIN) 130 if (user_schema == SCHEMA_PLAIN)
132 return result; 131 return result;
133 132
134 if (user_schema == SCHEMA_SALT_HASHED) { 133 if (user_schema == SCHEMA_SALT_HASHED) {
135 base::DictionaryValue holder; 134 base::DictionaryValue holder;
136 std::string salt; 135 std::string salt;
137 owner_->GetPasswordInformation(context.GetUserID(), &holder); 136 owner_->GetPasswordInformation(context.GetUserID(), &holder);
138 holder.GetStringWithoutPathExpansion(kSalt, &salt); 137 holder.GetStringWithoutPathExpansion(kSalt, &salt);
139 DCHECK(!salt.empty()); 138 DCHECK(!salt.empty());
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 LOG(FATAL) << "HMAC::Sign failed"; 350 LOG(FATAL) << "HMAC::Sign failed";
352 351
353 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes)); 352 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes));
354 353
355 std::string result; 354 std::string result;
356 base::Base64Encode(raw_result, &result); 355 base::Base64Encode(raw_result, &result);
357 return result; 356 return result;
358 } 357 }
359 358
360 } // namespace chromeos 359 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698