OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/webauth/authenticator_impl.h" | 5 #include "content/browser/webauth/authenticator_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void AuthenticatorImpl::MakeCredential( | 54 void AuthenticatorImpl::MakeCredential( |
55 webauth::mojom::MakeCredentialOptionsPtr options, | 55 webauth::mojom::MakeCredentialOptionsPtr options, |
56 MakeCredentialCallback callback) { | 56 MakeCredentialCallback callback) { |
57 std::string effective_domain; | 57 std::string effective_domain; |
58 std::string relying_party_id; | 58 std::string relying_party_id; |
59 std::string client_data_json; | 59 std::string client_data_json; |
60 base::DictionaryValue client_data; | 60 base::DictionaryValue client_data; |
61 | 61 |
62 // Steps 6 & 7 of https://w3c.github.io/webauthn/#createCredential | 62 // Steps 6 & 7 of https://w3c.github.io/webauthn/#createCredential |
63 // opaque origin | 63 // opaque origin |
64 if (caller_origin_.unique()) { | 64 if (caller_origin_.opaque()) { |
65 std::move(callback).Run( | 65 std::move(callback).Run( |
66 webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, NULL); | 66 webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, NULL); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 if (options->relying_party->id.empty()) { | 70 if (options->relying_party->id.empty()) { |
71 relying_party_id = caller_origin_.Serialize(); | 71 relying_party_id = caller_origin_.Serialize(); |
72 } else { | 72 } else { |
73 effective_domain = caller_origin_.host(); | 73 effective_domain = caller_origin_.host(); |
74 | 74 |
(...skipping 22 matching lines...) Expand all Loading... |
97 | 97 |
98 // SHA-256 hash the JSON data structure | 98 // SHA-256 hash the JSON data structure |
99 client_data_json = SerializeValueToJson(client_data); | 99 client_data_json = SerializeValueToJson(client_data); |
100 std::string client_data_hash = crypto::SHA256HashString(client_data_json); | 100 std::string client_data_hash = crypto::SHA256HashString(client_data_json); |
101 | 101 |
102 std::move(callback).Run(webauth::mojom::AuthenticatorStatus::NOT_IMPLEMENTED, | 102 std::move(callback).Run(webauth::mojom::AuthenticatorStatus::NOT_IMPLEMENTED, |
103 nullptr); | 103 nullptr); |
104 } | 104 } |
105 | 105 |
106 } // namespace content | 106 } // namespace content |
OLD | NEW |