Commit 7cbada43 authored by Martin Kreichgauer's avatar Martin Kreichgauer Committed by Commit Bot

fido: fix lifetime issue with MaybeAddPlatformAuthenticatorCallback

Currently, |AuthenticatorImpl| is binding
|CreatePlatformAuthenticatorIfAvailable| with |base::Unretained| for the
|MaybeAddPlatformAuthenticatorCallback| argument to the
|FidoRequestHandlerBase| ctor. The callback was originally invoked
synchronously from the ctor, but then recently changed to async
invocation to account for observer registration (crrev.com/c/1175418).

This is a potential callback lifetime issue because the
AuthenticatorImpl and its request handler can now theoretically get
destroyed before the callback gets invoked.

To work around this issue, replace the callback with a method on the
request handler invoked by the AuthenticatorImpl.

Bug: 875338
Change-Id: I089f0783a46791ae8d9d6bac5f0e663e52075b86
Reviewed-on: https://chromium-review.googlesource.com/1179081
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarJun Choi <hongjunchoi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584288}
parent ff3c1bc9
......@@ -490,9 +490,7 @@ void AuthenticatorImpl::MakeCredential(
individual_attestation),
std::move(authenticator_selection_criteria),
base::BindOnce(&AuthenticatorImpl::OnRegisterResponse,
weak_factory_.GetWeakPtr()),
base::BindOnce(&AuthenticatorImpl::CreatePlatformAuthenticatorIfAvailable,
base::Unretained(this)));
weak_factory_.GetWeakPtr()));
request_delegate_->RegisterActionCallbacks(
base::BindOnce(&AuthenticatorImpl::Cancel,
......@@ -501,6 +499,9 @@ void AuthenticatorImpl::MakeCredential(
&device::FidoRequestHandlerBase::StartAuthenticatorRequest,
request_->GetWeakPtr()) /* request_callback */);
request_->set_observer(request_delegate_.get());
request_->SetPlatformAuthenticatorOrMarkUnavailable(
CreatePlatformAuthenticatorIfAvailable());
}
// mojom:Authenticator
......@@ -573,9 +574,7 @@ void AuthenticatorImpl::GetAssertion(
std::move(options),
alternative_application_parameter_),
base::BindOnce(&AuthenticatorImpl::OnSignResponse,
weak_factory_.GetWeakPtr()),
base::BindOnce(&AuthenticatorImpl::CreatePlatformAuthenticatorIfAvailable,
base::Unretained(this)));
weak_factory_.GetWeakPtr()));
request_delegate_->RegisterActionCallbacks(
base::BindOnce(&AuthenticatorImpl::Cancel,
......@@ -584,6 +583,9 @@ void AuthenticatorImpl::GetAssertion(
&device::FidoRequestHandlerBase::StartAuthenticatorRequest,
request_->GetWeakPtr()) /* request_callback */);
request_->set_observer(request_delegate_.get());
request_->SetPlatformAuthenticatorOrMarkUnavailable(
CreatePlatformAuthenticatorIfAvailable());
}
void AuthenticatorImpl::IsUserVerifyingPlatformAuthenticatorAvailable(
......
......@@ -36,19 +36,9 @@ class FidoRequestHandler : public FidoRequestHandlerBase {
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports,
CompletionCallback completion_callback)
: FidoRequestHandler(connector,
available_transports,
std::move(completion_callback),
AddPlatformAuthenticatorCallback()) {}
FidoRequestHandler(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports,
CompletionCallback completion_callback,
AddPlatformAuthenticatorCallback add_platform_authenticator)
: FidoRequestHandlerBase(connector,
available_transports,
std::move(add_platform_authenticator)),
: FidoRequestHandlerBase(connector, available_transports),
completion_callback_(std::move(completion_callback)) {}
~FidoRequestHandler() override {
if (!is_complete())
CancelOngoingTasks();
......
......@@ -44,16 +44,7 @@ FidoRequestHandlerBase::TransportAvailabilityObserver::
FidoRequestHandlerBase::FidoRequestHandlerBase(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports)
: FidoRequestHandlerBase(connector,
available_transports,
AddPlatformAuthenticatorCallback()) {}
FidoRequestHandlerBase::FidoRequestHandlerBase(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports,
AddPlatformAuthenticatorCallback add_platform_authenticator)
: add_platform_authenticator_(std::move(add_platform_authenticator)),
weak_factory_(this) {
: weak_factory_(this) {
// The number of times |notify_observer_callback_| needs to be invoked before
// Observer::OnTransportAvailabilityEnumerated is dispatched. Essentially this
// is used to wait until all the parts of |transport_availability_info_| are
......@@ -79,8 +70,8 @@ FidoRequestHandlerBase::FidoRequestHandlerBase(
}
if (transport == FidoTransportProtocol::kInternal) {
// Internal authenticators are injected through
// AddPlatformAuthenticatorCallback.
// Platform authenticator availability is always indicated by
// |AuthenticatorImpl|.
continue;
}
......@@ -139,15 +130,6 @@ base::WeakPtr<FidoRequestHandlerBase> FidoRequestHandlerBase::GetWeakPtr() {
void FidoRequestHandlerBase::Start() {
for (const auto& discovery : discoveries_)
discovery->Start();
// Post |MaybeAddPlatformAuthenticator| into its own task. This avoids
// FidoAuthenticatorAdded() to be called synchronously from the constructor of
// FidoRequestHandlerBase prior to any TransportAvailabilityObserver being
// set.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&FidoRequestHandlerBase::MaybeAddPlatformAuthenticator,
weak_factory_.GetWeakPtr()));
}
void FidoRequestHandlerBase::DiscoveryStarted(FidoDiscovery* discovery,
......@@ -225,15 +207,13 @@ void FidoRequestHandlerBase::AddAuthenticator(
GetWeakPtr(), authenticator_ptr));
}
void FidoRequestHandlerBase::MaybeAddPlatformAuthenticator() {
std::unique_ptr<FidoAuthenticator> authenticator;
if (add_platform_authenticator_ &&
void FidoRequestHandlerBase::SetPlatformAuthenticatorOrMarkUnavailable(
std::unique_ptr<FidoAuthenticator> authenticator) {
if (authenticator &&
base::ContainsKey(transport_availability_info_.available_transports,
FidoTransportProtocol::kInternal)) {
authenticator = std::move(add_platform_authenticator_).Run();
}
if (authenticator) {
DCHECK(authenticator->AuthenticatorTransport() ==
FidoTransportProtocol::kInternal);
AddAuthenticator(std::move(authenticator));
} else {
transport_availability_info_.available_transports.erase(
......
......@@ -43,8 +43,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase
public:
using AuthenticatorMap =
std::map<std::string, std::unique_ptr<FidoAuthenticator>, std::less<>>;
using AddPlatformAuthenticatorCallback =
base::OnceCallback<std::unique_ptr<FidoAuthenticator>()>;
using RequestCallback = base::RepeatingCallback<void(const std::string&)>;
enum class RequestType { kMakeCredential, kGetAssertion };
......@@ -96,10 +94,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase
FidoRequestHandlerBase(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports);
FidoRequestHandlerBase(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& available_transports,
AddPlatformAuthenticatorCallback add_platform_authenticator);
~FidoRequestHandlerBase() override;
// Triggers DispatchRequest() if |active_authenticators_| hold
......@@ -128,6 +122,12 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase
notify_observer_callback_.Run();
}
// Set the platform authenticator for this request, if one is available.
// |AuthenticatorImpl| must call this method after invoking |set_oberver| even
// if no platform authenticator is available, in which case it passes nullptr.
void SetPlatformAuthenticatorOrMarkUnavailable(
std::unique_ptr<FidoAuthenticator> authenticator);
TransportAvailabilityInfo& transport_availability_info() {
return transport_availability_info_;
}
......@@ -158,7 +158,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase
void BluetoothAdapterPowerChanged(bool is_powered_on) final;
void AddAuthenticator(std::unique_ptr<FidoAuthenticator> authenticator);
void MaybeAddPlatformAuthenticator();
void NotifyObserverTransportAvailability();
AuthenticatorMap active_authenticators_;
......@@ -166,7 +165,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoRequestHandlerBase
TransportAvailabilityObserver* observer_ = nullptr;
TransportAvailabilityInfo transport_availability_info_;
base::RepeatingClosure notify_observer_callback_;
AddPlatformAuthenticatorCallback add_platform_authenticator_;
base::WeakPtrFactory<FidoRequestHandlerBase> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FidoRequestHandlerBase);
......
......@@ -137,15 +137,11 @@ class FakeFidoAuthenticator : public FidoDeviceAuthenticator {
class FakeFidoRequestHandler : public FidoRequestHandler<std::vector<uint8_t>> {
public:
FakeFidoRequestHandler(
const base::flat_set<FidoTransportProtocol>& protocols,
FakeHandlerCallback callback,
AddPlatformAuthenticatorCallback add_platform_authenticator =
AddPlatformAuthenticatorCallback())
FakeFidoRequestHandler(const base::flat_set<FidoTransportProtocol>& protocols,
FakeHandlerCallback callback)
: FidoRequestHandler(nullptr /* connector */,
protocols,
std::move(callback),
std::move(add_platform_authenticator)),
std::move(callback)),
weak_factory_(this) {
Start();
}
......@@ -191,21 +187,13 @@ class FidoRequestHandlerTest : public ::testing::Test {
std::unique_ptr<FakeFidoRequestHandler> CreateFakeHandler() {
ForgeNextHidDiscovery();
return std::make_unique<FakeFidoRequestHandler>(
auto handler = std::make_unique<FakeFidoRequestHandler>(
base::flat_set<FidoTransportProtocol>(
{FidoTransportProtocol::kUsbHumanInterfaceDevice,
FidoTransportProtocol::kBluetoothLowEnergy}),
cb_.callback());
}
std::unique_ptr<FakeFidoRequestHandler>
CreateFakeHandlerWithPlatformAuthenticatorCallback(
FidoRequestHandlerBase::AddPlatformAuthenticatorCallback
add_platform_authenticator) {
return std::make_unique<FakeFidoRequestHandler>(
base::flat_set<FidoTransportProtocol>(
{FidoTransportProtocol::kInternal}),
cb_.callback(), std::move(add_platform_authenticator));
handler->SetPlatformAuthenticatorOrMarkUnavailable(nullptr);
return handler;
}
test::FakeFidoDiscovery* discovery() const { return discovery_; }
......@@ -268,8 +256,8 @@ TEST_F(FidoRequestHandlerTest, TestAuthenticatorHandlerReset) {
request_handler.reset();
}
// Test a scenario where 2 devices are connected and a response is received from
// only a single device(device1) and the remaining device hangs.
// Test a scenario where 2 devices are connected and a response is received
// from only a single device(device1) and the remaining device hangs.
TEST_F(FidoRequestHandlerTest, TestRequestWithMultipleDevices) {
auto request_handler = CreateFakeHandler();
discovery()->WaitForCallToStartAndSimulateSuccess();
......@@ -342,11 +330,11 @@ TEST_F(FidoRequestHandlerTest, TestRequestWithMultipleSuccessResponses) {
}
// Test a scenario where 3 devices respond with a processing error, an UP(user
// presence) verified failure response with small time delay, and an UP verified
// failure response with big time delay, respectively. Request for device with
// processing error should be immediately dropped. Also, for UP verified
// failures, the first received response should be passed on to the relying
// party and cancel command should be sent to the remaining device.
// presence) verified failure response with small time delay, and an UP
// verified failure response with big time delay, respectively. Request for
// device with processing error should be immediately dropped. Also, for UP
// verified failures, the first received response should be passed on to the
// relying party and cancel command should be sent to the remaining device.
TEST_F(FidoRequestHandlerTest, TestRequestWithMultipleFailureResponses) {
auto request_handler = CreateFakeHandler();
discovery()->WaitForCallToStartAndSimulateSuccess();
......@@ -395,9 +383,9 @@ TEST_F(FidoRequestHandlerTest, TestRequestWithMultipleFailureResponses) {
callback().status());
}
// Requests should be dispatched to the authenticator returned from the
// AddPlatformAuthenticatorCallback if one is passed.
TEST_F(FidoRequestHandlerTest, TestPlatformAuthenticatorCallback) {
// Requests should be dispatched to the authenticator passed to
// SetPlatformAuthenticatorOrMarkUnavailable.
TEST_F(FidoRequestHandlerTest, TestSetPlatformAuthenticator) {
// A platform authenticator usually wouldn't usually use a FidoDevice, but
// that's not the point of the test here. The test is only trying to ensure
// the authenticator gets injected and used.
......@@ -406,18 +394,16 @@ TEST_F(FidoRequestHandlerTest, TestPlatformAuthenticatorCallback) {
// Device returns success response.
device->ExpectRequestAndRespondWith(std::vector<uint8_t>(),
CreateFakeSuccessDeviceResponse());
FidoRequestHandlerBase::AddPlatformAuthenticatorCallback
make_platform_authenticator = base::BindOnce(
[](FidoDevice* device) -> std::unique_ptr<FidoAuthenticator> {
return std::make_unique<FakeFidoAuthenticator>(device);
},
device.get());
device->SetDeviceTransport(FidoTransportProtocol::kInternal);
auto authenticator = std::make_unique<FakeFidoAuthenticator>(device.get());
TestTransportAvailabilityObserver observer;
auto request_handler = CreateFakeHandlerWithPlatformAuthenticatorCallback(
std::move(make_platform_authenticator));
auto request_handler = std::make_unique<FakeFidoRequestHandler>(
base::flat_set<FidoTransportProtocol>({FidoTransportProtocol::kInternal}),
callback().callback());
request_handler->set_observer(&observer);
request_handler->SetPlatformAuthenticatorOrMarkUnavailable(
std::move(authenticator));
observer.WaitForAndExpectAvailableTransportsAre(
{FidoTransportProtocol::kInternal});
......@@ -427,13 +413,14 @@ TEST_F(FidoRequestHandlerTest, TestPlatformAuthenticatorCallback) {
EXPECT_EQ(FidoReturnCode::kSuccess, callback().status());
}
TEST_F(FidoRequestHandlerTest,
InternalTransportDisallowedIfFactoryYieldsNoAuthenticator) {
TEST_F(FidoRequestHandlerTest, InternalTransportDisallowedIfMarkedUnavailable) {
TestTransportAvailabilityObserver observer;
auto request_handler =
CreateFakeHandlerWithPlatformAuthenticatorCallback(base::BindOnce(
[]() -> std::unique_ptr<FidoAuthenticator> { return nullptr; }));
auto request_handler = std::make_unique<FakeFidoRequestHandler>(
base::flat_set<FidoTransportProtocol>({FidoTransportProtocol::kInternal}),
callback().callback());
request_handler->set_observer(&observer);
request_handler->SetPlatformAuthenticatorOrMarkUnavailable(nullptr);
observer.WaitForAndExpectAvailableTransportsAre({});
}
......
......@@ -76,12 +76,12 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
CreateGetAssertionHandlerWithRequest(CtapGetAssertionRequest request) {
ForgeDiscoveries();
return std::make_unique<GetAssertionRequestHandler>(
auto handler = std::make_unique<GetAssertionRequestHandler>(
nullptr /* connector */, supported_transports_, std::move(request),
get_assertion_cb_.callback(),
base::BindOnce(
&FidoGetAssertionHandlerTest::CreatePlatformAuthenticator,
base::Unretained(this)));
get_assertion_cb_.callback());
handler->SetPlatformAuthenticatorOrMarkUnavailable(
CreatePlatformAuthenticator());
return handler;
}
void ExpectAllowedTransportsForRequestAre(
......@@ -94,8 +94,6 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
ble_discovery()->WaitForCallToStartAndSimulateSuccess();
if (base::ContainsKey(transports, Transport::kNearFieldCommunication))
nfc_discovery()->WaitForCallToStartAndSimulateSuccess();
if (base::ContainsKey(transports, Transport::kInternal))
platform_authenticator_factory().WaitForCallback();
scoped_task_environment_.FastForwardUntilNoTasksRemain();
EXPECT_FALSE(get_assertion_callback().was_called());
......@@ -106,8 +104,6 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
EXPECT_FALSE(ble_discovery()->is_start_requested());
if (!base::ContainsKey(transports, Transport::kNearFieldCommunication))
EXPECT_FALSE(nfc_discovery()->is_start_requested());
if (!base::ContainsKey(transports, Transport::kInternal))
EXPECT_FALSE(platform_authenticator_factory().was_called());
// Even with FidoTransportProtocol::kInternal allowed, unless the platform
// authenticator factory returns a FidoAuthenticator instance (which it will
......@@ -140,10 +136,6 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
mock_platform_device_ = std::move(device);
}
test::TestCallbackReceiver<>& platform_authenticator_factory() {
return create_platform_authenticator_receiver_;
}
void set_supported_transports(
base::flat_set<FidoTransportProtocol> transports) {
supported_transports_ = std::move(transports);
......@@ -151,7 +143,6 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
protected:
std::unique_ptr<FidoAuthenticator> CreatePlatformAuthenticator() {
create_platform_authenticator_receiver_.callback().Run();
if (!mock_platform_device_)
return nullptr;
return std::make_unique<FidoDeviceAuthenticator>(
......@@ -166,7 +157,6 @@ class FidoGetAssertionHandlerTest : public ::testing::Test {
test::FakeFidoDiscovery* ble_discovery_;
test::FakeFidoDiscovery* nfc_discovery_;
std::unique_ptr<MockFidoDevice> mock_platform_device_;
test::TestCallbackReceiver<> create_platform_authenticator_receiver_;
TestGetAssertionRequestCallback get_assertion_cb_;
base::flat_set<FidoTransportProtocol> supported_transports_ =
GetTestableTransportProtocols();
......
......@@ -151,25 +151,12 @@ GetAssertionRequestHandler::GetAssertionRequestHandler(
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapGetAssertionRequest request,
SignResponseCallback completion_callback)
: GetAssertionRequestHandler(connector,
supported_transports,
std::move(request),
std::move(completion_callback),
AddPlatformAuthenticatorCallback()) {}
GetAssertionRequestHandler::GetAssertionRequestHandler(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapGetAssertionRequest request,
SignResponseCallback completion_callback,
AddPlatformAuthenticatorCallback add_platform_authenticator)
: FidoRequestHandler(
connector,
base::STLSetIntersection<base::flat_set<FidoTransportProtocol>>(
supported_transports,
GetTransportsAllowedByRP(request)),
std::move(completion_callback),
std::move(add_platform_authenticator)),
std::move(completion_callback)),
request_(std::move(request)),
weak_factory_(this) {
transport_availability_info().rp_id = request.rp_id();
......
......@@ -38,12 +38,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) GetAssertionRequestHandler
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapGetAssertionRequest request_parameter,
SignResponseCallback completion_callback);
GetAssertionRequestHandler(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapGetAssertionRequest request_parameter,
SignResponseCallback completion_callback,
AddPlatformAuthenticatorCallback add_platform_authenticator);
~GetAssertionRequestHandler() override;
private:
......
......@@ -77,12 +77,12 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
test_data::kClientDataHash, std::move(rp), std::move(user),
std::move(credential_params));
return std::make_unique<MakeCredentialRequestHandler>(
auto handler = std::make_unique<MakeCredentialRequestHandler>(
nullptr, supported_transports_, std::move(request_parameter),
std::move(authenticator_selection_criteria), cb_.callback(),
base::BindOnce(
&FidoMakeCredentialHandlerTest::CreatePlatformAuthenticator,
base::Unretained(this)));
std::move(authenticator_selection_criteria), cb_.callback());
handler->SetPlatformAuthenticatorOrMarkUnavailable(
CreatePlatformAuthenticator());
return handler;
}
void ExpectAllowedTransportsForRequestAre(
......@@ -95,8 +95,6 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
ble_discovery()->WaitForCallToStartAndSimulateSuccess();
if (base::ContainsKey(transports, Transport::kNearFieldCommunication))
nfc_discovery()->WaitForCallToStartAndSimulateSuccess();
if (base::ContainsKey(transports, Transport::kInternal))
platform_authenticator_factory().WaitForCallback();
scoped_task_environment_.FastForwardUntilNoTasksRemain();
EXPECT_FALSE(callback().was_called());
......@@ -107,8 +105,6 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
EXPECT_FALSE(ble_discovery()->is_start_requested());
if (!base::ContainsKey(transports, Transport::kNearFieldCommunication))
EXPECT_FALSE(nfc_discovery()->is_start_requested());
if (!base::ContainsKey(transports, Transport::kInternal))
EXPECT_FALSE(platform_authenticator_factory().was_called());
// Even with FidoTransportProtocol::kInternal allowed, unless the platform
// authenticator factory returns a FidoAuthenticator instance (which it will
......@@ -139,10 +135,6 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
mock_platform_device_ = std::move(device);
}
test::TestCallbackReceiver<>& platform_authenticator_factory() {
return create_platform_authenticator_receiver_;
}
void set_supported_transports(
base::flat_set<FidoTransportProtocol> transports) {
supported_transports_ = std::move(transports);
......@@ -150,7 +142,6 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
protected:
std::unique_ptr<FidoAuthenticator> CreatePlatformAuthenticator() {
create_platform_authenticator_receiver_.callback().Run();
if (!mock_platform_device_)
return nullptr;
return std::make_unique<FidoDeviceAuthenticator>(
......@@ -165,7 +156,6 @@ class FidoMakeCredentialHandlerTest : public ::testing::Test {
test::FakeFidoDiscovery* ble_discovery_;
test::FakeFidoDiscovery* nfc_discovery_;
std::unique_ptr<MockFidoDevice> mock_platform_device_;
test::TestCallbackReceiver<> create_platform_authenticator_receiver_;
TestMakeCredentialRequestCallback cb_;
base::flat_set<FidoTransportProtocol> supported_transports_ =
GetTestableTransportProtocols();
......@@ -363,6 +353,7 @@ TEST_F(FidoMakeCredentialHandlerTest,
set_supported_transports({FidoTransportProtocol::kInternal});
auto platform_device = MockFidoDevice::MakeCtap(
ReadCTAPGetInfoResponse(test_data::kTestGetInfoResponsePlatformDevice));
platform_device->SetDeviceTransport(FidoTransportProtocol::kInternal);
EXPECT_CALL(*platform_device, GetId())
.WillRepeatedly(testing::Return("device0"));
platform_device->ExpectCtap2CommandAndRespondWith(
......@@ -413,6 +404,7 @@ TEST_F(FidoMakeCredentialHandlerTest,
PlatformAuthenticatorPretendingToBeCrossPlatform) {
auto platform_device = MockFidoDevice::MakeCtap(
ReadCTAPGetInfoResponse(test_data::kTestAuthenticatorGetInfoResponse));
platform_device->SetDeviceTransport(FidoTransportProtocol::kInternal);
EXPECT_CALL(*platform_device, GetId())
.WillRepeatedly(testing::Return("device0"));
set_mock_platform_device(std::move(platform_device));
......@@ -425,7 +417,6 @@ TEST_F(FidoMakeCredentialHandlerTest,
true /* require_resident_key */,
UserVerificationRequirement::kRequired));
platform_authenticator_factory().WaitForCallback();
scoped_task_environment_.FastForwardUntilNoTasksRemain();
EXPECT_FALSE(callback().was_called());
}
......
......@@ -98,27 +98,12 @@ MakeCredentialRequestHandler::MakeCredentialRequestHandler(
CtapMakeCredentialRequest request,
AuthenticatorSelectionCriteria authenticator_selection_criteria,
RegisterResponseCallback completion_callback)
: MakeCredentialRequestHandler(connector,
supported_transports,
std::move(request),
authenticator_selection_criteria,
std::move(completion_callback),
AddPlatformAuthenticatorCallback()) {}
MakeCredentialRequestHandler::MakeCredentialRequestHandler(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapMakeCredentialRequest request,
AuthenticatorSelectionCriteria authenticator_selection_criteria,
RegisterResponseCallback completion_callback,
AddPlatformAuthenticatorCallback add_platform_authenticator)
: FidoRequestHandler(
connector,
base::STLSetIntersection<base::flat_set<FidoTransportProtocol>>(
supported_transports,
GetTransportsAllowedByRP(authenticator_selection_criteria)),
std::move(completion_callback),
std::move(add_platform_authenticator)),
std::move(completion_callback)),
request_parameter_(std::move(request)),
authenticator_selection_criteria_(
std::move(authenticator_selection_criteria)),
......
......@@ -41,13 +41,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) MakeCredentialRequestHandler
CtapMakeCredentialRequest request_parameter,
AuthenticatorSelectionCriteria authenticator_criteria,
RegisterResponseCallback completion_callback);
MakeCredentialRequestHandler(
service_manager::Connector* connector,
const base::flat_set<FidoTransportProtocol>& supported_transports,
CtapMakeCredentialRequest request_parameter,
AuthenticatorSelectionCriteria authenticator_criteria,
RegisterResponseCallback completion_callback,
AddPlatformAuthenticatorCallback add_platform_authenticator);
~MakeCredentialRequestHandler() override;
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment