• Martin Kreichgauer's avatar
    fido: move FidoAuthenticator instantiation into FidoDiscovery · aa4628b3
    Martin Kreichgauer authored
    This change extracts an abstract base class called FidoDiscoveryBase
    from FidoDiscovery. The FidoDiscovery::Observer interface is moved into
    the base class, and its signature is changed to allow observing the
    instantiation and destruction of FidoAuthenticator instances rather than
    FidoDevice. I.e. FidoDiscovery::Observer::Device{Added,Removed} becomes
    FidoDiscoveryBase::Observer::Authenticator{Added,Removed}.
    
    FidoDiscovery takes on the responsibility of instantiating and owning
    FidoAuthenticator instances (more specifically, FidoDeviceAuthenticator
    instances). The AuthenticatorMap in FidoRequestHandlerBase now only
    holds plain FidoAuthenticator pointers, rather than owning the
    unique_ptrs.
    
    This gets us closer to getting platform-y authenticators (Touch ID,
    Windows) injected via Discovery implementations, rather than
    implementing custom interaction between FidoRequestHandlerBase and
    AuthenticatorImpl for them (see
    SetPlatformAuthenticatorOrMarkUnavailable).
    
    Better naming might have been "FidoDeviceDiscovery" for FidoDiscovery
    and perhaps "FidoDiscovery" for FidoDiscoveryBase, but that would be a
    rather large diff.
    
    A sensible additional refactoring might be to make
    FidoDeviceAuthenticator own its associated FidoDevice.
    
    Change-Id: I05d9c24819745c784fef3898bec8d6bb63d2f503
    Reviewed-on: https://chromium-review.googlesource.com/c/1256016
    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@{#596882}
    aa4628b3
fido_request_handler_base.cc 10.9 KB