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

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

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef WebAuthentication_h 5 #ifndef WebAuthentication_h
6 #define WebAuthentication_h 6 #define WebAuthentication_h
7 7
8 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" 8 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h"
engedy 2017/07/05 18:51:08 nit: No longer used in the header, move to .cpp.
kpaulhamus 2017/07/12 21:21:48 Done.
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
engedy 2017/07/05 18:51:08 nit: I think the complete type is not needed in th
kpaulhamus 2017/07/12 21:21:48 Done.
10 #include "core/dom/ContextLifecycleObserver.h" 10 #include "core/dom/ContextLifecycleObserver.h"
11 #include "core/dom/DOMArrayBuffer.h" 11 #include "core/dom/DOMArrayBuffer.h"
engedy 2017/07/05 18:51:08 nit: No longer used in the header, move to .cpp.
kpaulhamus 2017/07/12 21:21:48 Done.
12 #include "modules/webauth/AuthenticationAssertionOptions.h" 12 #include "modules/webauth/MakeCredentialOptions.h"
engedy 2017/07/05 18:51:08 nit: Fwd-declaration suffices in the header, move
kpaulhamus 2017/07/12 21:21:48 Done.
13 #include "modules/webauth/ScopedCredentialInfo.h"
14 #include "platform/bindings/ScriptWrappable.h" 13 #include "platform/bindings/ScriptWrappable.h"
15 #include "public/platform/modules/webauth/authenticator.mojom-blink.h" 14 #include "public/platform/modules/webauth/authenticator.mojom-blink.h"
16 15
17 namespace blink { 16 namespace blink {
18 17
19 class RelyingPartyAccount; 18 class LocalFrame;
20 class AuthenticationAssertionOptions; 19 class MakeCredentialOptions;
21 class ScopedCredentialOptions; 20 class PublicKeyCredentialRequestOptions;
22 class ScopedCredentialParameters; 21 class ScriptState;
23 class ScriptPromiseResolver;
24 22
25 typedef ArrayBufferOrArrayBufferView BufferSource; 23 typedef ArrayBufferOrArrayBufferView BufferSource;
engedy 2017/07/05 18:51:08 nit: No longer used in the header, move to .cpp.
kpaulhamus 2017/07/12 21:21:48 Done.
26 24
27 class WebAuthentication final 25 class WebAuthentication final
28 : public GarbageCollectedFinalized<WebAuthentication>, 26 : public GarbageCollectedFinalized<WebAuthentication>,
29 public ScriptWrappable, 27 public ScriptWrappable,
30 public ContextLifecycleObserver { 28 public ContextLifecycleObserver {
engedy 2017/07/05 18:51:08 nit: No longer used, including its header.
kpaulhamus 2017/07/12 21:21:48 Done.
31 DEFINE_WRAPPERTYPEINFO(); 29 DEFINE_WRAPPERTYPEINFO();
32 USING_GARBAGE_COLLECTED_MIXIN(WebAuthentication); 30 USING_GARBAGE_COLLECTED_MIXIN(WebAuthentication);
33 31
34 public: 32 public:
35 static WebAuthentication* Create(LocalFrame& frame) { 33 static WebAuthentication* Create(LocalFrame& frame) {
36 return new WebAuthentication(frame); 34 return new WebAuthentication(frame);
37 } 35 }
38 36
39 virtual ~WebAuthentication(); 37 virtual ~WebAuthentication();
40 38
41 // WebAuthentication.idl 39 // WebAuthentication.idl
42 ScriptPromise makeCredential(ScriptState*, 40 ScriptPromise makeCredential(ScriptState*, MakeCredentialOptions&);
engedy 2017/07/05 18:51:08 nit: Can the second argument be const too here?
kpaulhamus 2017/07/12 21:21:49 Done.
43 const RelyingPartyAccount&, 41
44 const HeapVector<ScopedCredentialParameters>,
45 const BufferSource&,
46 ScopedCredentialOptions&);
47 ScriptPromise getAssertion(ScriptState*, 42 ScriptPromise getAssertion(ScriptState*,
48 const BufferSource&, 43 const PublicKeyCredentialRequestOptions&);
49 const AuthenticationAssertionOptions&);
50 44
51 webauth::mojom::blink::Authenticator* Authenticator() const { 45 webauth::mojom::blink::Authenticator* Authenticator() const {
52 return authenticator_.get(); 46 return authenticator_.get();
53 } 47 }
54 48
55 // ContextLifecycleObserver overrides. 49 void OnMakeCredential(ScriptPromiseResolver*,
engedy 2017/07/05 18:51:08 nit: Need fwd-declaration for class ScriptPromiseR
engedy 2017/07/05 18:51:08 nit: Do these need to be public?
kpaulhamus 2017/07/12 21:21:48 Done.
kpaulhamus 2017/07/12 21:21:48 Done.
56 void ContextDestroyed(ExecutionContext*) override; 50 webauth::mojom::blink::AuthenticatorStatus,
51 webauth::mojom::blink::PublicKeyCredentialInfoPtr);
52 ScriptPromise RejectIfNotSupported(ScriptState*);
53 void OnAuthenticatorConnectionError();
54 bool MarkRequestComplete(ScriptPromiseResolver*);
55 void Cleanup();
57 56
58 DECLARE_VIRTUAL_TRACE(); 57 DECLARE_VIRTUAL_TRACE();
59 58
60 private: 59 private:
61 explicit WebAuthentication(LocalFrame&); 60 explicit WebAuthentication(LocalFrame&);
62 61
63 void OnMakeCredential(ScriptPromiseResolver*,
64 webauth::mojom::blink::AuthenticatorStatus,
65 webauth::mojom::blink::ScopedCredentialInfoPtr);
66 ScriptPromise RejectIfNotSupported(ScriptState*);
67 void OnAuthenticatorConnectionError();
68 bool MarkRequestComplete(ScriptPromiseResolver*);
69 void Cleanup();
70
71 webauth::mojom::blink::AuthenticatorPtr authenticator_; 62 webauth::mojom::blink::AuthenticatorPtr authenticator_;
72 HeapHashSet<Member<ScriptPromiseResolver>> authenticator_requests_; 63 HeapHashSet<Member<ScriptPromiseResolver>> authenticator_requests_;
73 }; 64 };
74 } // namespace blink 65 } // namespace blink
75 66
76 #endif // WebAuthentication_h 67 #endif // WebAuthentication_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698