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/supervised/supervised_user_authenticatio
n.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 key->GetRawKey(&raw_result); | 51 key->GetRawKey(&raw_result); |
52 base::Base64Encode(raw_result, &result); | 52 base::Base64Encode(raw_result, &result); |
53 return result; | 53 return result; |
54 } | 54 } |
55 | 55 |
56 base::DictionaryValue* LoadPasswordData(base::FilePath profile_dir) { | 56 base::DictionaryValue* LoadPasswordData(base::FilePath profile_dir) { |
57 JSONFileValueDeserializer deserializer( | 57 JSONFileValueDeserializer deserializer( |
58 profile_dir.Append(kPasswordUpdateFile)); | 58 profile_dir.Append(kPasswordUpdateFile)); |
59 std::string error_message; | 59 std::string error_message; |
60 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; | 60 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; |
61 scoped_ptr<base::Value> value( | 61 scoped_ptr<base::Value> value = |
62 deserializer.Deserialize(&error_code, &error_message)); | 62 deserializer.Deserialize(&error_code, &error_message); |
63 if (JSONFileValueDeserializer::JSON_NO_ERROR != error_code) { | 63 if (JSONFileValueDeserializer::JSON_NO_ERROR != error_code) { |
64 LOG(ERROR) << "Could not deserialize password data, error = " << error_code | 64 LOG(ERROR) << "Could not deserialize password data, error = " << error_code |
65 << " / " << error_message; | 65 << " / " << error_message; |
66 return NULL; | 66 return NULL; |
67 } | 67 } |
68 base::DictionaryValue* result; | 68 base::DictionaryValue* result; |
69 if (!value->GetAsDictionary(&result)) { | 69 if (!value->GetAsDictionary(&result)) { |
70 LOG(ERROR) << "Stored password data is not a dictionary"; | 70 LOG(ERROR) << "Stored password data is not a dictionary"; |
71 return NULL; | 71 return NULL; |
72 } | 72 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 LOG(FATAL) << "HMAC::Sign failed"; | 316 LOG(FATAL) << "HMAC::Sign failed"; |
317 | 317 |
318 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes)); | 318 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes)); |
319 | 319 |
320 std::string result; | 320 std::string result; |
321 base::Base64Encode(raw_result, &result); | 321 base::Base64Encode(raw_result, &result); |
322 return result; | 322 return result; |
323 } | 323 } |
324 | 324 |
325 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |