Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef DEVICE_FIDO_GET_ASSERTION_REQUEST_HANDLER_H_ |
| 6 | #define DEVICE_FIDO_GET_ASSERTION_REQUEST_HANDLER_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | #include "base/callback.h" |
| 11 | #include "base/macros.h" |
| 12 | #include "base/memory/weak_ptr.h" |
| 13 | #include "base/optional.h" |
| 14 | #include "device/fido/ctap_get_assertion_request.h" |
| 15 | #include "device/fido/fido_constants.h" |
| 16 | #include "device/fido/fido_request_handler.h" |
Jun Choi | b60937e | 2018-04-12 17:02:38 | [diff] [blame] | 17 | #include "device/fido/fido_transport_protocol.h" |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 18 | |
| 19 | namespace service_manager { |
| 20 | class Connector; |
Nico Weber | 40cd26fd | 2019-02-09 17:37:02 | [diff] [blame] | 21 | } // namespace service_manager |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 22 | |
| 23 | namespace device { |
| 24 | |
Martin Kreichgauer | 4a022e6 | 2018-05-09 20:53:10 | [diff] [blame] | 25 | class FidoAuthenticator; |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 26 | class AuthenticatorGetAssertionResponse; |
| 27 | |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 28 | class COMPONENT_EXPORT(DEVICE_FIDO) GetAssertionRequestHandler |
| 29 | : public FidoRequestHandler<AuthenticatorGetAssertionResponse> { |
| 30 | public: |
| 31 | GetAssertionRequestHandler( |
| 32 | service_manager::Connector* connector, |
Balazs Engedy | 159452d | 2018-08-16 15:18:18 | [diff] [blame] | 33 | const base::flat_set<FidoTransportProtocol>& supported_transports, |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 34 | CtapGetAssertionRequest request_parameter, |
Martin Kreichgauer | c6de3bc | 2018-11-13 03:14:00 | [diff] [blame] | 35 | CompletionCallback completion_callback); |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 36 | ~GetAssertionRequestHandler() override; |
| 37 | |
| 38 | private: |
| 39 | // FidoRequestHandlerBase: |
Martin Kreichgauer | 4a022e6 | 2018-05-09 20:53:10 | [diff] [blame] | 40 | void DispatchRequest(FidoAuthenticator* authenticator) override; |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 41 | |
Martin Kreichgauer | 8987fd0 | 2018-07-20 22:42:03 | [diff] [blame] | 42 | void HandleResponse( |
| 43 | FidoAuthenticator* authenticator, |
| 44 | CtapDeviceResponseCode response_code, |
| 45 | base::Optional<AuthenticatorGetAssertionResponse> response); |
| 46 | |
Jun Choi | 4fc8b781 | 2018-04-05 07:39:07 | [diff] [blame] | 47 | CtapGetAssertionRequest request_; |
| 48 | base::WeakPtrFactory<GetAssertionRequestHandler> weak_factory_; |
| 49 | |
| 50 | DISALLOW_COPY_AND_ASSIGN(GetAssertionRequestHandler); |
| 51 | }; |
| 52 | |
| 53 | } // namespace device |
| 54 | |
| 55 | #endif // DEVICE_FIDO_GET_ASSERTION_REQUEST_HANDLER_H_ |