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

Side by Side Diff: third_party/WebKit/Source/modules/webauth/WebAuthentication.cpp

Issue 2966523002: Blink-layer update to match WebAuthN spec (Closed)
Patch Set: Modify browser-side impl and unittests. Address mkwst comments. Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
engedy 2017/07/05 18:51:07 nit: Time machine? :)
kpaulhamus 2017/07/12 21:21:47 :-)
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 "modules/webauth/WebAuthentication.h" 5 #include "modules/webauth/WebAuthentication.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
11 #include "core/dom/DOMException.h" 11 #include "core/dom/DOMException.h"
12 #include "core/dom/Document.h" 12 #include "core/dom/Document.h"
engedy 2017/07/05 18:51:07 nit: Will be unneeded once the ContextLifecycleObs
kpaulhamus 2017/07/12 21:21:48 It's still needed for GetFrame.
engedy 2017/07/13 11:33:53 Acknowledged.
13 #include "core/dom/ExceptionCode.h" 13 #include "core/dom/ExceptionCode.h"
14 #include "core/frame/LocalFrame.h" 14 #include "core/frame/LocalFrame.h"
15 #include "modules/webauth/RelyingPartyAccount.h" 15 #include "modules/webauth/AuthenticatorAssertionResponse.h"
16 #include "modules/webauth/ScopedCredential.h" 16 #include "modules/webauth/AuthenticatorAttestationResponse.h"
17 #include "modules/webauth/ScopedCredentialOptions.h" 17 #include "modules/webauth/PublicKeyCredential.h"
engedy 2017/07/05 18:51:07 nit: AuthenticatorAssertionResponse and PublicKeyC
kpaulhamus 2017/07/12 21:21:47 Done.
18 #include "modules/webauth/ScopedCredentialParameters.h"
19 #include "public/platform/InterfaceProvider.h" 18 #include "public/platform/InterfaceProvider.h"
20 19
21 namespace { 20 namespace {
22 const char kNoAuthenticatorError[] = "Authenticator unavailable."; 21 const char kNoAuthenticatorError[] = "Authenticator unavailable.";
23 // Time to wait for an authenticator to successfully complete an operation. 22 // Time to wait for an authenticator to successfully complete an operation.
24 const int kAdjustedTimeoutLowerInSeconds = 60; 23 const int64_t kAdjustedTimeoutLowerInMilliseconds = 60000;
25 const int kAdjustedTimeoutUpperInSeconds = 120; 24 const int64_t kAdjustedTimeoutUpperInMilliseconds = 12000;
vasilii 2017/07/05 14:36:13 constexpr
engedy 2017/07/05 18:51:07 Also, could this directly be `constexpr WTF::TimeD
engedy 2017/07/05 18:51:08 Missing trailing 0? i.e. 12 sec instead of 2 minut
kpaulhamus 2017/07/12 21:21:48 Done.
kpaulhamus 2017/07/12 21:21:48 good catch
kpaulhamus 2017/07/12 21:21:48 Yep, that's a good idea.
26 } // anonymous namespace 25 } // anonymous namespace
27 26
28 namespace mojo { 27 namespace mojo {
29 using webauth::mojom::blink::RelyingPartyAccount;
30 using webauth::mojom::blink::RelyingPartyAccountPtr;
31 using webauth::mojom::blink::AuthenticatorStatus; 28 using webauth::mojom::blink::AuthenticatorStatus;
32 using webauth::mojom::blink::ScopedCredentialDescriptor; 29 using webauth::mojom::blink::MakeCredentialOptionsPtr;
33 using webauth::mojom::blink::ScopedCredentialOptions; 30 using webauth::mojom::blink::PublicKeyCredentialEntityPtr;
34 using webauth::mojom::blink::ScopedCredentialOptionsPtr; 31 using webauth::mojom::blink::PublicKeyCredentialParametersPtr;
35 using webauth::mojom::blink::ScopedCredentialParameters; 32 using webauth::mojom::blink::PublicKeyCredentialType;
36 using webauth::mojom::blink::ScopedCredentialParametersPtr;
37 using webauth::mojom::blink::ScopedCredentialType;
38 using webauth::mojom::blink::Transport; 33 using webauth::mojom::blink::Transport;
39 34
40 // TODO(kpaulhamus): Make this a TypeConverter 35 // TODO(kpaulhamus): Make this a TypeConverter
41 Vector<uint8_t> ConvertBufferSource(const blink::BufferSource& buffer) { 36 Vector<uint8_t> ConvertBufferSource(const blink::BufferSource& buffer) {
42 DCHECK(!buffer.isNull()); 37 DCHECK(!buffer.isNull());
43 Vector<uint8_t> vector; 38 Vector<uint8_t> vector;
44 if (buffer.isArrayBuffer()) { 39 if (buffer.isArrayBuffer()) {
45 vector.Append(static_cast<uint8_t*>(buffer.getAsArrayBuffer()->Data()), 40 vector.Append(static_cast<uint8_t*>(buffer.getAsArrayBuffer()->Data()),
46 buffer.getAsArrayBuffer()->ByteLength()); 41 buffer.getAsArrayBuffer()->ByteLength());
47 } else { 42 } else {
48 vector.Append(static_cast<uint8_t*>( 43 vector.Append(static_cast<uint8_t*>(
engedy 2017/07/05 18:51:06 nit: DCHECK(buffer.isArrayBufferView());
kpaulhamus 2017/07/12 21:21:47 Done.
49 buffer.getAsArrayBufferView().View()->BaseAddress()), 44 buffer.getAsArrayBufferView().View()->BaseAddress()),
50 buffer.getAsArrayBufferView().View()->byteLength()); 45 buffer.getAsArrayBufferView().View()->byteLength());
51 } 46 }
52 return vector; 47 return vector;
53 } 48 }
54 49
55 // TODO(kpaulhamus): Make this a TypeConverter 50 // TODO(kpaulhamus): Make this a TypeConverter
56 ScopedCredentialType ConvertScopedCredentialType(const String& cred_type) { 51 PublicKeyCredentialType ConvertPublicKeyCredentialType(
57 if (cred_type == "ScopedCred") 52 const String& cred_type) {
engedy 2017/07/05 18:51:06 nit: Let's avoid abbreviations, and make this eith
kpaulhamus 2017/07/12 21:21:47 Done.
58 return ScopedCredentialType::SCOPEDCRED; 53 if (cred_type == "public-key")
54 return PublicKeyCredentialType::PUBLICKEY;
59 NOTREACHED(); 55 NOTREACHED();
60 return ScopedCredentialType::SCOPEDCRED; 56 return PublicKeyCredentialType::PUBLICKEY;
61 } 57 }
62 58
63 // TODO(kpaulhamus): Make this a TypeConverter 59 // TODO(kpaulhamus): Make this a TypeConverter
64 Transport ConvertTransport(const String& transport) { 60 Transport ConvertTransport(const String& transport) {
65 if (transport == "usb") 61 if (transport == "usb")
66 return Transport::USB; 62 return Transport::USB;
67 if (transport == "nfc") 63 if (transport == "nfc")
68 return Transport::NFC; 64 return Transport::NFC;
69 if (transport == "ble") 65 if (transport == "ble")
70 return Transport::BLE; 66 return Transport::BLE;
71 NOTREACHED(); 67 NOTREACHED();
72 return Transport::USB; 68 return Transport::USB;
73 } 69 }
74 70
75 // TODO(kpaulhamus): Make this a TypeConverter 71 // TODO(kpaulhamus): Make this a TypeConverter
76 RelyingPartyAccountPtr ConvertRelyingPartyAccount( 72 PublicKeyCredentialEntityPtr ConvertPublicKeyCredentialUserEntity(
77 const blink::RelyingPartyAccount& account_information, 73 const blink::PublicKeyCredentialUserEntity& user) {
78 blink::ScriptPromiseResolver* resolver) { 74 auto entity = webauth::mojom::blink::PublicKeyCredentialEntity::New();
79 auto mojo_account = RelyingPartyAccount::New(); 75 entity->id = user.id();
80 76 entity->name = user.name();
81 mojo_account->relying_party_display_name = 77 if (user.hasIcon()) {
82 account_information.rpDisplayName(); 78 entity->icon = blink::KURL(blink::KURL(), user.icon());
83 mojo_account->display_name = account_information.displayName(); 79 }
84 mojo_account->id = account_information.id(); 80 entity->display_name = user.displayName();
85 mojo_account->name = account_information.name(); 81 return entity;
86 mojo_account->image_url = account_information.imageURL();
87 return mojo_account;
88 } 82 }
89 83
90 // TODO(kpaulhamus): Make this a TypeConverter 84 // TODO(kpaulhamus): Make this a TypeConverter
91 ScopedCredentialOptionsPtr ConvertScopedCredentialOptions( 85 PublicKeyCredentialEntityPtr ConvertPublicKeyCredentialEntity(
92 const blink::ScopedCredentialOptions options, 86 const blink::PublicKeyCredentialEntity& rp) {
93 blink::ScriptPromiseResolver* resolver) { 87 auto entity = webauth::mojom::blink::PublicKeyCredentialEntity::New();
94 auto mojo_options = ScopedCredentialOptions::New(); 88 entity->id = rp.id();
95 if (options.hasRpId()) { 89 entity->name = rp.name();
96 // if rpID is missing, it will later be set to the origin of the page 90 if (rp.hasIcon()) {
97 // in the secure browser process. 91 entity->icon = blink::KURL(blink::KURL(), rp.icon());
98 mojo_options->relying_party_id = options.rpId(); 92 }
93 return entity;
94 }
95
96 // TODO(kpaulhamus): Make this a TypeConverter
97 PublicKeyCredentialParametersPtr ConvertPublicKeyCredentialParameters(
98 const blink::PublicKeyCredentialParameters parameter) {
99 auto mojo_parameter =
100 webauth::mojom::blink::PublicKeyCredentialParameters::New();
101 mojo_parameter->type = ConvertPublicKeyCredentialType(parameter.type());
102 // TODO(kpaulhamus): add AlgorithmIdentifier
103 return mojo_parameter;
104 }
105
106 // TODO(kpaulhamus): Make this a TypeConverter
107 MakeCredentialOptionsPtr ConvertMakeCredentialOptions(
108 const blink::MakeCredentialOptions options) {
109 auto mojo_options = webauth::mojom::blink::MakeCredentialOptions::New();
110 mojo_options->relying_party = ConvertPublicKeyCredentialEntity(options.rp());
111 mojo_options->user = ConvertPublicKeyCredentialUserEntity(options.user());
112 mojo_options->challenge = ConvertBufferSource(options.challenge());
113
114 Vector<webauth::mojom::blink::PublicKeyCredentialParametersPtr> parameters;
115 for (const auto& parameter : options.parameters()) {
116 if (parameter.hasType()) {
engedy 2017/07/05 18:51:07 nit: I'm not very familiar with this, but I wonder
kpaulhamus 2017/07/12 21:21:47 Good point.
117 parameters.push_back(ConvertPublicKeyCredentialParameters(parameter));
118 }
119 }
120 mojo_options->crypto_parameters = std::move(parameters);
121
122 // Step 4 of https://w3c.github.io/webauthn/#createCredential
123 int64_t predicted_timeout;
engedy 2017/07/05 18:51:06 nit: What does predicted mean in this context? I d
kpaulhamus 2017/07/12 21:21:48 It's essentially a temp variable. I'll change the
engedy 2017/07/13 11:33:54 Much clearer, thank you!
124 if (options.hasTimeout()) {
125 predicted_timeout = options.timeout();
126 } else {
127 predicted_timeout = kAdjustedTimeoutLowerInMilliseconds;
99 } 128 }
100 129
101 // Step 4 of https://w3c.github.io/webauthn/#createCredential 130 mojo_options->adjusted_timeout = WTF::TimeDelta::FromMilliseconds(std::max(
engedy 2017/07/05 18:51:07 nit: Can we use WTF::clampTo here?
kpaulhamus 2017/07/12 21:21:47 I didn't know about clampTo, that's nifty. I tried
engedy 2017/07/13 11:33:53 That's a shame. And yes, I agree, using WTF::TimeD
102 int predicted_timeout = kAdjustedTimeoutLowerInSeconds; 131 kAdjustedTimeoutLowerInMilliseconds,
103 if (options.hasTimeoutSeconds()) { 132 std::min(kAdjustedTimeoutUpperInMilliseconds, predicted_timeout)));
104 predicted_timeout = static_cast<int>(options.timeoutSeconds());
105 }
106
107 mojo_options->adjusted_timeout = static_cast<double>(
108 std::max(kAdjustedTimeoutLowerInSeconds,
109 std::min(kAdjustedTimeoutUpperInSeconds, predicted_timeout)));
110 133
111 if (options.hasExcludeList()) { 134 if (options.hasExcludeList()) {
112 // Adds the excludeList members (which are ScopedCredentialDescriptors) 135 // Adds the excludeList members (which are PublicKeyCredentialDescriptors)
113 for (const auto& descriptor : options.excludeList()) { 136 for (const auto& descriptor : options.excludeList()) {
114 auto mojo_descriptor = ScopedCredentialDescriptor::New(); 137 auto mojo_descriptor =
115 mojo_descriptor->type = ConvertScopedCredentialType(descriptor.type()); 138 webauth::mojom::blink::PublicKeyCredentialDescriptor::New();
139 mojo_descriptor->type = ConvertPublicKeyCredentialType(descriptor.type());
116 mojo_descriptor->id = ConvertBufferSource(descriptor.id()); 140 mojo_descriptor->id = ConvertBufferSource(descriptor.id());
117 for (const auto& transport : descriptor.transports()) 141 for (const auto& transport : descriptor.transports())
118 mojo_descriptor->transports.push_back(ConvertTransport(transport)); 142 mojo_descriptor->transports.push_back(ConvertTransport(transport));
119 mojo_options->exclude_list.push_back(std::move(mojo_descriptor)); 143 mojo_options->exclude_list.push_back(std::move(mojo_descriptor));
120 } 144 }
121 } 145 }
122 // TODO(kpaulhamus): add AuthenticationExtensions;
123 return mojo_options; 146 return mojo_options;
124 } 147 }
125 148
126 // TODO(kpaulhamus): Make this a TypeConverter
127 ScopedCredentialParametersPtr ConvertScopedCredentialParameter(
128 const blink::ScopedCredentialParameters parameter,
129 blink::ScriptPromiseResolver* resolver) {
130 auto mojo_parameter = ScopedCredentialParameters::New();
131 mojo_parameter->type = ConvertScopedCredentialType(parameter.type());
132 // TODO(kpaulhamus): add AlgorithmIdentifier
133 return mojo_parameter;
134 }
135
136 blink::DOMException* CreateExceptionFromStatus(AuthenticatorStatus status) { 149 blink::DOMException* CreateExceptionFromStatus(AuthenticatorStatus status) {
137 switch (status) { 150 switch (status) {
138 case AuthenticatorStatus::NOT_IMPLEMENTED: 151 case AuthenticatorStatus::NOT_IMPLEMENTED:
139 return blink::DOMException::Create(blink::kNotSupportedError, 152 return blink::DOMException::Create(blink::kNotSupportedError,
140 "Not implemented."); 153 "Not implemented.");
141 case AuthenticatorStatus::NOT_ALLOWED_ERROR: 154 case AuthenticatorStatus::NOT_ALLOWED_ERROR:
142 return blink::DOMException::Create(blink::kNotAllowedError, 155 return blink::DOMException::Create(blink::kNotAllowedError,
143 "Not allowed."); 156 "Not allowed.");
144 case AuthenticatorStatus::NOT_SUPPORTED_ERROR: 157 case AuthenticatorStatus::NOT_SUPPORTED_ERROR:
145 return blink::DOMException::Create( 158 return blink::DOMException::Create(
146 blink::kNotSupportedError, 159 blink::kNotSupportedError,
147 "Parameters for this operation are not supported."); 160 "Parameters for this operation are not supported.");
148 case AuthenticatorStatus::SECURITY_ERROR: 161 case AuthenticatorStatus::SECURITY_ERROR:
149 return blink::DOMException::Create(blink::kSecurityError, 162 return blink::DOMException::Create(blink::kSecurityError,
150 "The operation was not allowed."); 163 "The operation was not allowed.");
151 case AuthenticatorStatus::UNKNOWN_ERROR: 164 case AuthenticatorStatus::UNKNOWN_ERROR:
152 return blink::DOMException::Create(blink::kUnknownError, 165 return blink::DOMException::Create(blink::kUnknownError,
153 "Request failed."); 166 "Request failed.");
154 case AuthenticatorStatus::CANCELLED: 167 case AuthenticatorStatus::CANCELLED:
155 return blink::DOMException::Create(blink::kNotAllowedError, 168 return blink::DOMException::Create(blink::kNotAllowedError,
156 "User canceled the operation."); 169 "User canceled the operation.");
157 case AuthenticatorStatus::SUCCESS: 170 case AuthenticatorStatus::SUCCESS:
158 return nullptr; 171 return nullptr;
159 default: 172 default:
160 NOTREACHED(); 173 NOTREACHED();
161 return nullptr; 174 return nullptr;
162 } 175 }
163 } 176 }
engedy 2017/07/05 18:51:07 nit: Add blank line after
kpaulhamus 2017/07/12 21:21:48 Done.
164 } // namespace mojo 177 } // namespace mojo
165 178
166 namespace blink { 179 namespace blink {
180
167 WebAuthentication::WebAuthentication(LocalFrame& frame) 181 WebAuthentication::WebAuthentication(LocalFrame& frame)
168 : ContextLifecycleObserver(frame.GetDocument()) {} 182 : ContextLifecycleObserver(frame.GetDocument()) {
183 frame.GetInterfaceProvider()->GetInterface(
184 mojo::MakeRequest(&authenticator_));
185 authenticator_.set_connection_error_handler(ConvertToBaseCallback(
186 WTF::Bind(&WebAuthentication::OnAuthenticatorConnectionError,
187 WrapWeakPersistent(this))));
188 }
169 189
170 WebAuthentication::~WebAuthentication() { 190 WebAuthentication::~WebAuthentication() {
171 // |authenticator_| may still be valid but there should be no more 191 // |authenticator_| may still be valid but there should be no more
172 // outstanding requests because each holds a persistent handle to this object. 192 // outstanding requests because each holds a persistent handle to this object.
173 DCHECK(authenticator_requests_.IsEmpty()); 193 DCHECK(authenticator_requests_.IsEmpty());
174 } 194 }
175 195
176 ScriptPromise WebAuthentication::makeCredential( 196 ScriptPromise WebAuthentication::makeCredential(
177 ScriptState* script_state, 197 ScriptState* script_state,
178 const RelyingPartyAccount& account_information, 198 MakeCredentialOptions& publicKey) {
179 const HeapVector<ScopedCredentialParameters> crypto_parameters, 199 if (!authenticator_) {
180 const BufferSource& attestation_challenge, 200 return ScriptPromise::RejectWithDOMException(
181 ScopedCredentialOptions& options) { 201 script_state, DOMException::Create(kNotSupportedError));
182 ScriptPromise promise = RejectIfNotSupported(script_state); 202 }
183 if (!promise.IsEmpty())
184 return promise;
185 203
186 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); 204 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
205 ScriptPromise promise = resolver->Promise();
engedy 2017/07/05 18:51:07 nit: Do we need to make this call here because of
kpaulhamus 2017/07/12 21:21:48 Could you clarify what kind of comment you mean? T
engedy 2017/07/13 11:33:54 Sorry for the ambiguous phrasing. I was indeed jus
187 206
188 Vector<uint8_t> buffer = mojo::ConvertBufferSource(attestation_challenge); 207 auto options = mojo::ConvertMakeCredentialOptions(publicKey);
189 auto opts = mojo::ConvertScopedCredentialOptions(options, resolver);
190 Vector<webauth::mojom::blink::ScopedCredentialParametersPtr> parameters;
191 for (const auto& parameter : crypto_parameters) {
192 if (parameter.hasType()) {
193 parameters.push_back(
194 mojo::ConvertScopedCredentialParameter(parameter, resolver));
195 }
196 }
197 auto account =
198 mojo::ConvertRelyingPartyAccount(account_information, resolver);
199 authenticator_requests_.insert(resolver); 208 authenticator_requests_.insert(resolver);
200 authenticator_->MakeCredential( 209 authenticator_->MakeCredential(
201 std::move(account), std::move(parameters), buffer, std::move(opts), 210 std::move(options), ConvertToBaseCallback(WTF::Bind(
202 ConvertToBaseCallback(WTF::Bind(&WebAuthentication::OnMakeCredential, 211 &WebAuthentication::OnMakeCredential,
203 WrapPersistent(this), 212 WrapPersistent(this), WrapPersistent(resolver))));
204 WrapPersistent(resolver)))); 213 return promise;
205 return resolver->Promise();
206 } 214 }
207 215
208 ScriptPromise WebAuthentication::getAssertion( 216 ScriptPromise WebAuthentication::getAssertion(
209 ScriptState* script_state, 217 ScriptState* script_state,
210 const BufferSource& assertion_challenge, 218 const PublicKeyCredentialRequestOptions& publicKey) {
211 const AuthenticationAssertionOptions& options) {
212 NOTREACHED(); 219 NOTREACHED();
213 return ScriptPromise(); 220 return ScriptPromise();
214 } 221 }
215 222
216 void WebAuthentication::ContextDestroyed(ExecutionContext*) {
engedy 2017/07/05 18:51:07 Hmm, how come we don't need this anymore?
kpaulhamus 2017/07/12 21:21:48 I was going to put it back, but it's a ContextLife
engedy 2017/07/13 11:33:53 Could you please explain to me why we don't need i
kpaulhamus 2017/07/13 16:00:53 Yeah, in WebAuthentication.h/.cpp in Patch 2, you
engedy 2017/07/13 20:27:12 Sorry, misunderstanding. I suggested removing only
217 Cleanup();
218 }
219
220 void WebAuthentication::OnMakeCredential( 223 void WebAuthentication::OnMakeCredential(
221 ScriptPromiseResolver* resolver, 224 ScriptPromiseResolver* resolver,
222 webauth::mojom::blink::AuthenticatorStatus status, 225 webauth::mojom::blink::AuthenticatorStatus status,
223 webauth::mojom::blink::ScopedCredentialInfoPtr credential) { 226 webauth::mojom::blink::PublicKeyCredentialInfoPtr credential) {
224 if (!MarkRequestComplete(resolver)) 227 if (!MarkRequestComplete(resolver))
225 return; 228 return;
226 229
227 DOMException* error = mojo::CreateExceptionFromStatus(status); 230 DOMException* error = mojo::CreateExceptionFromStatus(status);
228 if (error) { 231 if (error) {
229 DCHECK(!credential); 232 DCHECK(!credential);
230 resolver->Reject(error); 233 resolver->Reject(error);
231 Cleanup(); 234 Cleanup();
232 return; 235 return;
233 } 236 }
234 237
235 if (credential->client_data.IsEmpty() || credential->attestation.IsEmpty()) { 238 if (credential->client_data_json.IsEmpty() ||
239 credential->response->attestation_object.IsEmpty()) {
236 resolver->Reject( 240 resolver->Reject(
237 DOMException::Create(kNotFoundError, "No credential returned.")); 241 DOMException::Create(kNotFoundError, "No credentials returned."));
238 return;
239 } 242 }
240 243
241 DOMArrayBuffer* clientDataBuffer = DOMArrayBuffer::Create( 244 DOMArrayBuffer* client_data_buffer = DOMArrayBuffer::Create(
242 static_cast<void*>(&credential->client_data.front()), 245 static_cast<void*>(&credential->client_data_json.front()),
243 credential->client_data.size()); 246 credential->client_data_json.size());
244 247
245 DOMArrayBuffer* attestationBuffer = DOMArrayBuffer::Create( 248 // Return AuthenticatorAttestationResponse
246 static_cast<void*>(&credential->attestation.front()), 249 DOMArrayBuffer* attestation_buffer = DOMArrayBuffer::Create(
247 credential->attestation.size()); 250 static_cast<void*>(&credential->response->attestation_object.front()),
251 credential->response->attestation_object.size());
248 252
249 ScopedCredentialInfo* scopedCredential = 253 AuthenticatorAttestationResponse* attestation_response =
250 ScopedCredentialInfo::Create(clientDataBuffer, attestationBuffer); 254 AuthenticatorAttestationResponse::Create(client_data_buffer,
251 resolver->Resolve(scopedCredential); 255 attestation_buffer);
256 resolver->Resolve(attestation_response);
252 } 257 }
253 258
254 ScriptPromise WebAuthentication::RejectIfNotSupported( 259 ScriptPromise WebAuthentication::RejectIfNotSupported(
engedy 2017/07/05 18:51:06 Looks like this is not used anymore?
kpaulhamus 2017/07/12 21:21:48 Ah, it's supposed to be used. Bad merge/rebase.
255 ScriptState* script_state) { 260 ScriptState* script_state) {
256 if (!authenticator_) { 261 if (!authenticator_) {
257 if (!GetFrame()) { 262 if (!GetFrame()) {
258 return ScriptPromise::RejectWithDOMException( 263 return ScriptPromise::RejectWithDOMException(
259 script_state, DOMException::Create(kNotSupportedError)); 264 script_state, DOMException::Create(kNotSupportedError));
260 } 265 }
261 GetFrame()->GetInterfaceProvider()->GetInterface( 266 GetFrame()->GetInterfaceProvider()->GetInterface(
262 mojo::MakeRequest(&authenticator_)); 267 mojo::MakeRequest(&authenticator_));
263 268
264 authenticator_.set_connection_error_handler(ConvertToBaseCallback( 269 authenticator_.set_connection_error_handler(ConvertToBaseCallback(
(...skipping 24 matching lines...) Expand all
289 ContextLifecycleObserver::Trace(visitor); 294 ContextLifecycleObserver::Trace(visitor);
290 } 295 }
291 296
292 // Clears the promise resolver, timer, and closes the Mojo connection. 297 // Clears the promise resolver, timer, and closes the Mojo connection.
293 void WebAuthentication::Cleanup() { 298 void WebAuthentication::Cleanup() {
294 authenticator_.reset(); 299 authenticator_.reset();
295 authenticator_requests_.clear(); 300 authenticator_requests_.clear();
296 } 301 }
297 302
298 } // namespace blink 303 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698