⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249108 in webkit


Ignore:
Timestamp:
Aug 26, 2019, 11:43:09 AM (7 years ago)
Author:
jiewen_tan@apple.com
Message:

[WebAuthn] Support HID authenticators on iOS
https://bugs.webkit.org/show_bug.cgi?id=201084
<rdar://problem/51908390>

Reviewed by Youenn Fablet.

Source/WebCore/PAL:

  • pal/spi/cocoa/IOKitSPI.h:

Move IOHIDDevice.h and IOHIDManager.h to IOKitSPI.h given they are in iOS.

Source/WebKit:

This patch makes the macOS HID implementation available in iOS as well.
Mostly, it removes the PLATFORM(MAC) compile time flag.

  • UIProcess/WebAuthentication/AuthenticatorManager.cpp:

(WebKit::AuthenticatorManagerInternal::collectTransports):

  • UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:

(WebKit::AuthenticatorTransportService::create):
(WebKit::AuthenticatorTransportService::createMock):

  • UIProcess/WebAuthentication/Cocoa/HidConnection.h:
  • UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
  • UIProcess/WebAuthentication/Cocoa/HidService.h:
  • UIProcess/WebAuthentication/Cocoa/HidService.mm:
  • UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:

(WebKit::NfcConnection::NfcConnection):
A tentative solution before there is an official UI.

  • UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
  • UIProcess/WebAuthentication/Mock/MockHidConnection.h:
  • UIProcess/WebAuthentication/Mock/MockHidService.cpp:
  • UIProcess/WebAuthentication/Mock/MockHidService.h:
  • UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
  • UIProcess/WebAuthentication/fido/CtapHidDriver.h:

LayoutTests:

  • platform/ios-wk2/TestExpectations:

Unskips HID tests for iOS.

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249107 r249108  
     12019-08-26  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthn] Support HID authenticators on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=201084
     5        <rdar://problem/51908390>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        * platform/ios-wk2/TestExpectations:
     10        Unskips HID tests for iOS.
     11
    1122019-08-26  Jiewen Tan  <jiewen_tan@apple.com>
    213
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r248037 r249108  
    12881288webkit.org/b/189641 [ Debug ] webgl/2.0.0/conformance/attribs/gl-vertexattribpointer.html [ Slow ]
    12891289
    1290 # Skip WebAuthN tests for hid authenticators
    1291 http/wpt/webauthn/ctap-hid-failure.https.html [ Skip ]
    1292 http/wpt/webauthn/ctap-hid-success.https.html [ Skip ]
    1293 http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html [ Skip ]
    1294 http/wpt/webauthn/public-key-credential-create-failure-hid.https.html [ Skip ]
    1295 http/wpt/webauthn/public-key-credential-create-success-hid.https.html [ Skip ]
    1296 http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html [ Skip ]
    1297 http/wpt/webauthn/public-key-credential-get-failure-hid.https.html [ Skip ]
    1298 http/wpt/webauthn/public-key-credential-get-success-hid.https.html [ Skip ]
    1299 http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html [ Skip ]
    1300 http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html [ Skip ]
    1301 http/wpt/webauthn/public-key-credential-create-success-u2f.https.html [ Skip ]
    1302 http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html [ Skip ]
    1303 http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html [ Skip ]
    1304 http/wpt/webauthn/public-key-credential-get-success-u2f.https.html [ Skip ]
    1305 
    13061290# FIXME: Unskip these tests once we have the fix for <rdar://problem/44930119>.
    13071291fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-after-hiding-auto-fill-strong-password-button.html [ Skip ]
  • trunk/Source/WebCore/PAL/ChangeLog

    r249036 r249108  
     12019-08-26  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthn] Support HID authenticators on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=201084
     5        <rdar://problem/51908390>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        * pal/spi/cocoa/IOKitSPI.h:
     10        Move IOHIDDevice.h and IOHIDManager.h to IOKitSPI.h given they are in iOS.
     11
    1122019-08-22  Andy Estes  <aestes@apple.com>
    213
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/IOKitSPI.h

    r245161 r249108  
    2828#if USE(APPLE_INTERNAL_SDK)
    2929
     30#import <IOKit/hid/IOHIDDevice.h>
    3031#import <IOKit/hid/IOHIDEvent.h>
    3132#import <IOKit/hid/IOHIDEventData.h>
    3233#import <IOKit/hid/IOHIDEventSystemClient.h>
     34#import <IOKit/hid/IOHIDManager.h>
    3335#import <IOKit/hid/IOHIDUsageTables.h>
    3436
     
    209211};
    210212
     213typedef struct CF_BRIDGED_TYPE(id) __IOHIDDevice * IOHIDDeviceRef;
     214
     215typedef kern_return_t IOReturn;
     216
     217enum IOHIDReportType {
     218    kIOHIDReportTypeInput = 0,
     219    kIOHIDReportTypeOutput,
     220};
     221
     222enum {
     223    kIOHIDOptionsTypeNone     = 0x00,
     224};
     225typedef uint32_t IOHIDOptionsType;
     226
     227typedef UInt32 IOOptionBits;
     228
     229typedef void (*IOHIDReportCallback) (void*, IOReturn, void*, IOHIDReportType, uint32_t, uint8_t*, CFIndex);
     230
     231IOReturn IOHIDDeviceOpen(IOHIDDeviceRef, IOOptionBits);
     232void IOHIDDeviceScheduleWithRunLoop(IOHIDDeviceRef, CFRunLoopRef, CFStringRef);
     233void IOHIDDeviceRegisterInputReportCallback(IOHIDDeviceRef, uint8_t*, CFIndex, IOHIDReportCallback, void*);
     234void IOHIDDeviceUnscheduleFromRunLoop(IOHIDDeviceRef, CFRunLoopRef, CFStringRef);
     235IOReturn IOHIDDeviceClose(IOHIDDeviceRef, IOOptionBits);
     236IOReturn IOHIDDeviceSetReport(IOHIDDeviceRef, IOHIDReportType, CFIndex, const uint8_t*, CFIndex);
     237
     238typedef struct CF_BRIDGED_TYPE(id) __IOHIDManager * IOHIDManagerRef;
     239
     240#define kIOHIDPrimaryUsagePageKey "PrimaryUsagePage"
     241#define kIOHIDPrimaryUsageKey "PrimaryUsage"
     242
     243typedef void (*IOHIDDeviceCallback) (void*, IOReturn, void*, IOHIDDeviceRef);
     244
     245IOHIDManagerRef IOHIDManagerCreate(CFAllocatorRef, IOOptionBits);
     246void IOHIDManagerSetDeviceMatching(IOHIDManagerRef, CFDictionaryRef);
     247void IOHIDManagerRegisterDeviceMatchingCallback(IOHIDManagerRef, IOHIDDeviceCallback, void*);
     248void IOHIDManagerRegisterDeviceRemovalCallback(IOHIDManagerRef, IOHIDDeviceCallback, void*);
     249void IOHIDManagerUnscheduleFromRunLoop(IOHIDManagerRef, CFRunLoopRef, CFStringRef);
     250IOReturn IOHIDManagerClose(IOHIDManagerRef, IOOptionBits);
     251void IOHIDManagerScheduleWithRunLoop(IOHIDManagerRef, CFRunLoopRef, CFStringRef);
     252IOReturn IOHIDManagerOpen(IOHIDManagerRef, IOOptionBits);
     253
    211254WTF_EXTERN_C_END
    212255
  • trunk/Source/WebKit/ChangeLog

    r249101 r249108  
     12019-08-26  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthn] Support HID authenticators on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=201084
     5        <rdar://problem/51908390>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        This patch makes the macOS HID implementation available in iOS as well.
     10        Mostly, it removes the PLATFORM(MAC) compile time flag.
     11
     12        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
     13        (WebKit::AuthenticatorManagerInternal::collectTransports):
     14        * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
     15        (WebKit::AuthenticatorTransportService::create):
     16        (WebKit::AuthenticatorTransportService::createMock):
     17        * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
     18        * UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
     19        * UIProcess/WebAuthentication/Cocoa/HidService.h:
     20        * UIProcess/WebAuthentication/Cocoa/HidService.mm:
     21        * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
     22        (WebKit::NfcConnection::NfcConnection):
     23        A tentative solution before there is an official UI.
     24        * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
     25        * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
     26        * UIProcess/WebAuthentication/Mock/MockHidService.cpp:
     27        * UIProcess/WebAuthentication/Mock/MockHidService.h:
     28        * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
     29        * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
     30
    1312019-08-26  Russell Epstein  <repstein@apple.com>
    232
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp

    r249059 r249108  
    3838namespace AuthenticatorManagerInternal {
    3939
    40 #if PLATFORM(MAC)
    4140const size_t maxTransportNumber = 3;
    42 #else
    43 const size_t maxTransportNumber = 2;
    44 #endif
    4541
    4642// Suggested by WebAuthN spec as of 7 August 2018.
     
    5450        auto addResult = result.add(AuthenticatorTransport::Internal);
    5551        ASSERT_UNUSED(addResult, addResult.isNewEntry);
    56 #if PLATFORM(MAC)
    5752        addResult = result.add(AuthenticatorTransport::Usb);
    5853        ASSERT_UNUSED(addResult, addResult.isNewEntry);
    59 #endif
    6054        addResult = result.add(AuthenticatorTransport::Nfc);
    6155        ASSERT_UNUSED(addResult, addResult.isNewEntry);
     
    6963    }
    7064    if (authenticatorSelection->authenticatorAttachment == PublicKeyCredentialCreationOptions::AuthenticatorAttachment::CrossPlatform) {
    71         auto addResult = result.add(AuthenticatorTransport::Nfc);
    72         ASSERT_UNUSED(addResult, addResult.isNewEntry);
    73 #if PLATFORM(MAC)
    74         addResult = result.add(AuthenticatorTransport::Usb);
    75         ASSERT_UNUSED(addResult, addResult.isNewEntry);
    76 #endif
     65        auto addResult = result.add(AuthenticatorTransport::Usb);
     66        ASSERT_UNUSED(addResult, addResult.isNewEntry);
     67        addResult = result.add(AuthenticatorTransport::Nfc);
     68        ASSERT_UNUSED(addResult, addResult.isNewEntry);
    7769        return result;
    7870    }
     
    9385        auto addResult = result.add(AuthenticatorTransport::Internal);
    9486        ASSERT_UNUSED(addResult, addResult.isNewEntry);
    95 #if PLATFORM(MAC)
    9687        addResult = result.add(AuthenticatorTransport::Usb);
    9788        ASSERT_UNUSED(addResult, addResult.isNewEntry);
    98 #endif
    9989        addResult = result.add(AuthenticatorTransport::Nfc);
    10090        ASSERT_UNUSED(addResult, addResult.isNewEntry);
     
    10595        if (allowCredential.transports.isEmpty()) {
    10696            result.add(AuthenticatorTransport::Internal);
    107 #if PLATFORM(MAC)
    10897            result.add(AuthenticatorTransport::Usb);
    109 #endif
    11098            result.add(AuthenticatorTransport::Nfc);
    11199            return result;
     
    113101        if (!result.contains(AuthenticatorTransport::Internal) && allowCredential.transports.contains(AuthenticatorTransport::Internal))
    114102            result.add(AuthenticatorTransport::Internal);
    115 #if PLATFORM(MAC)
    116103        if (!result.contains(AuthenticatorTransport::Usb) && allowCredential.transports.contains(AuthenticatorTransport::Usb))
    117104            result.add(AuthenticatorTransport::Usb);
    118 #endif
    119105        if (!result.contains(AuthenticatorTransport::Nfc) && allowCredential.transports.contains(AuthenticatorTransport::Nfc))
    120106            result.add(AuthenticatorTransport::Nfc);
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp

    r249059 r249108  
    4444    case WebCore::AuthenticatorTransport::Internal:
    4545        return makeUniqueRef<LocalService>(observer);
    46 #if PLATFORM(MAC)
    4746    case WebCore::AuthenticatorTransport::Usb:
    4847        return makeUniqueRef<HidService>(observer);
    49 #endif
    5048    case WebCore::AuthenticatorTransport::Nfc:
    5149        return makeUniqueRef<NfcService>(observer);
     
    6159    case WebCore::AuthenticatorTransport::Internal:
    6260        return makeUniqueRef<MockLocalService>(observer, configuration);
    63 #if PLATFORM(MAC)
    6461    case WebCore::AuthenticatorTransport::Usb:
    6562        return makeUniqueRef<MockHidService>(observer, configuration);
    66 #endif
    6763    case WebCore::AuthenticatorTransport::Nfc:
    6864        return makeUniqueRef<MockNfcService>(observer, configuration);
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.h

    r238246 r249108  
    2626#pragma once
    2727
    28 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     28#if ENABLE(WEB_AUTHN)
    2929
    30 #include <IOKit/hid/IOHIDDevice.h>
     30#include <pal/spi/cocoa/IOKitSPI.h>
    3131#include <wtf/CompletionHandler.h>
    3232#include <wtf/Deque.h>
     
    8383} // namespace WebKit
    8484
    85 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     85#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm

    r239078 r249108  
    2727#import "HidConnection.h"
    2828
    29 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     29#if ENABLE(WEB_AUTHN)
    3030
    3131#import <WebCore/FidoConstants.h>
     
    135135} // namespace WebKit
    136136
    137 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     137#endif // ENABLE(WEB_AUTHN)
    138138
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h

    r249059 r249108  
    2626#pragma once
    2727
    28 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     28#if ENABLE(WEB_AUTHN)
    2929
    3030#include "FidoService.h"
    31 #include <IOKit/hid/IOHIDManager.h>
     31#include <pal/spi/cocoa/IOKitSPI.h>
    3232#include <wtf/RetainPtr.h>
    3333#include <wtf/UniqueRef.h>
     
    5656} // namespace WebKit
    5757
    58 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     58#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.mm

    r249059 r249108  
    2727#import "HidService.h"
    2828
    29 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     29#if ENABLE(WEB_AUTHN)
    3030
    3131#import "CtapHidDriver.h"
     
    9191} // namespace WebKit
    9292
    93 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     93#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcConnection.mm

    r249068 r249108  
    5353    [m_session setDelegate:m_delegate.get()];
    5454    // FIXME(200933)
    55     [m_session updateUIAlertMessage:@"Hold the key against the top of your device."];
     55    [m_session updateUIAlertMessage:@"Insert your security key or hold the key against the top of your device."];
    5656    [m_session startPolling];
    5757}
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp

    r249059 r249108  
    2727#include "MockHidConnection.h"
    2828
    29 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     29#if ENABLE(WEB_AUTHN)
    3030
    3131#include <WebCore/AuthenticatorGetInfoResponse.h>
     
    293293} // namespace WebKit
    294294
    295 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     295#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h

    r239752 r249108  
    2626#pragma once
    2727
    28 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     28#if ENABLE(WEB_AUTHN)
    2929
    3030#include "HidConnection.h"
     
    7373} // namespace WebKit
    7474
    75 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     75#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp

    r238936 r249108  
    2727#include "MockHidService.h"
    2828
    29 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     29#if ENABLE(WEB_AUTHN)
    3030
    3131#include "MockHidConnection.h"
     
    5656} // namespace WebKit
    5757
    58 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     58#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h

    r238166 r249108  
    2626#pragma once
    2727
    28 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     28#if ENABLE(WEB_AUTHN)
    2929
    3030#include "HidService.h"
     
    4848} // namespace WebKit
    4949
    50 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     50#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp

    r248631 r249108  
    2727#include "CtapHidDriver.h"
    2828
    29 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     29#if ENABLE(WEB_AUTHN)
    3030
    3131#include <WebCore/FidoConstants.h>
     
    221221} // namespace WebKit
    222222
    223 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     223#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h

    r248631 r249108  
    2626#pragma once
    2727
    28 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     28#if ENABLE(WEB_AUTHN)
    2929
    3030#include "CtapDriver.h"
     
    100100} // namespace WebKit
    101101
    102 #endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)
     102#endif // ENABLE(WEB_AUTHN)
Note: See TracChangeset for help on using the changeset viewer.