Changeset 276184 in webkit
- Timestamp:
- Apr 16, 2021, 5:14:03 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r276182 r276184 1 2021-04-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 Pass credential name to the WebAuthn UI during registration 4 https://bugs.webkit.org/show_bug.cgi?id=224697 5 <rdar://75803352> 6 7 Reviewed by Brent Fulgham. 8 9 Covered by new test contents within existing test files. 10 11 * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: 12 Paperwork for the new SPI. 13 14 * UIProcess/API/APIWebAuthenticationPanel.cpp: 15 (API::WebAuthenticationPanel::create): 16 (API::WebAuthenticationPanel::WebAuthenticationPanel): 17 * UIProcess/API/APIWebAuthenticationPanel.h: 18 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: 19 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: 20 (-[_WKWebAuthenticationPanel userName]): 21 Adds a new userName property. 22 23 * UIProcess/WebAuthentication/AuthenticatorManager.cpp: 24 (WebKit::WebCore::getUserName): 25 (WebKit::AuthenticatorManager::runPanel): 26 (WebKit::AuthenticatorManager::runPresenter): 27 Passes the userName to the UI. 28 29 * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: 30 * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: 31 Paperwork for the new SPI. 32 33 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: 34 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: 35 (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): 36 Passes the userName to the new SPI. 37 1 38 2021-04-16 Cameron McCormack <heycam@apple.com> 2 39 -
trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h
r272708 r276184 115 115 }; 116 116 117 @interface ASCPublicKeyCredentialCreationOptions : NSObject <NSSecureCoding> 118 119 @property (nonatomic, copy) NSData *challenge; 120 @property (nonatomic, copy) NSString *relyingPartyIdentifier; 121 @property (nonatomic, copy) NSString *userName; 122 @property (nonatomic, copy) NSData *userIdentifier; 123 @property (nonatomic, copy) NSString *userDisplayName; 124 @property (nonatomic, copy) NSArray<NSNumber *> *supportedAlgorithmIdentifiers; 125 126 @property (nonatomic) BOOL shouldRequireResidentKey; 127 128 @end 129 117 130 @interface ASCSecurityKeyPublicKeyCredentialLoginChoice : NSObject <ASCLoginChoiceProtocol> 118 131 119 - (instancetype)initRegistrationChoice ;132 - (instancetype)initRegistrationChoiceWithOptions:(ASCPublicKeyCredentialCreationOptions *)options; 120 133 - (instancetype)initWithName:(NSString *)name displayName:(NSString *)displayName userHandle:(NSData *)userHandle; 121 134 - (instancetype)initAssertionPlaceholderChoice; … … 133 146 @interface ASCPlatformPublicKeyCredentialLoginChoice : NSObject <ASCLoginChoiceProtocol> 134 147 135 - (instancetype)initRegistrationChoice ;148 - (instancetype)initRegistrationChoiceWithOptions:(ASCPublicKeyCredentialCreationOptions *)options; 136 149 - (instancetype)initWithName:(NSString *)name displayName:(NSString *)displayName userHandle:(NSData *)userHandle; 137 150 -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp
r272184 r276184 38 38 using namespace WebKit; 39 39 40 Ref<WebAuthenticationPanel> WebAuthenticationPanel::create(const AuthenticatorManager& manager, const WTF::String& rpId, const TransportSet& transports, ClientDataType type )40 Ref<WebAuthenticationPanel> WebAuthenticationPanel::create(const AuthenticatorManager& manager, const WTF::String& rpId, const TransportSet& transports, ClientDataType type, const WTF::String& userName) 41 41 { 42 return adoptRef(*new WebAuthenticationPanel(manager, rpId, transports, type ));42 return adoptRef(*new WebAuthenticationPanel(manager, rpId, transports, type, userName)); 43 43 } 44 44 … … 50 50 } 51 51 52 WebAuthenticationPanel::WebAuthenticationPanel(const AuthenticatorManager& manager, const WTF::String& rpId, const TransportSet& transports, ClientDataType type )52 WebAuthenticationPanel::WebAuthenticationPanel(const AuthenticatorManager& manager, const WTF::String& rpId, const TransportSet& transports, ClientDataType type, const WTF::String& userName) 53 53 : m_client(makeUniqueRef<WebAuthenticationPanelClient>()) 54 54 , m_weakManager(makeWeakPtr(manager)) 55 55 , m_rpId(rpId) 56 56 , m_clientDataType(type) 57 , m_userName(userName) 57 58 { 58 59 m_transports = Vector<AuthenticatorTransport>(); -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h
r272184 r276184 70 70 // FIXME: <rdar://problem/71509848> Remove the following deprecated methods. 71 71 using TransportSet = HashSet<WebCore::AuthenticatorTransport, WTF::IntHash<WebCore::AuthenticatorTransport>, WTF::StrongEnumHashTraits<WebCore::AuthenticatorTransport>>; 72 static Ref<WebAuthenticationPanel> create(const WebKit::AuthenticatorManager&, const WTF::String& rpId, const TransportSet&, WebCore::ClientDataType );72 static Ref<WebAuthenticationPanel> create(const WebKit::AuthenticatorManager&, const WTF::String& rpId, const TransportSet&, WebCore::ClientDataType, const WTF::String& userName); 73 73 WTF::String rpId() const { return m_rpId; } 74 74 const Vector<WebCore::AuthenticatorTransport>& transports() const { return m_transports; } 75 75 WebCore::ClientDataType clientDataType() const { return m_clientDataType; } 76 WTF::String userName() const { return m_userName; } 76 77 77 78 private: 78 79 // FIXME: <rdar://problem/71509848> Remove the following deprecated method. 79 WebAuthenticationPanel(const WebKit::AuthenticatorManager&, const WTF::String& rpId, const TransportSet&, WebCore::ClientDataType );80 WebAuthenticationPanel(const WebKit::AuthenticatorManager&, const WTF::String& rpId, const TransportSet&, WebCore::ClientDataType, const WTF::String& userName); 80 81 81 82 std::unique_ptr<WebKit::AuthenticatorManager> m_manager; // FIXME: <rdar://problem/71509848> Change to UniqueRef. … … 87 88 Vector<WebCore::AuthenticatorTransport> m_transports; 88 89 WebCore::ClientDataType m_clientDataType; 90 WTF::String m_userName; 89 91 }; 90 92 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h
r272826 r276184 121 121 @property (nonatomic, readonly, copy) NSSet *transports; 122 122 @property (nonatomic, readonly) _WKWebAuthenticationType type; 123 @property (nonatomic, readonly, copy, nullable) NSString *userName; 123 124 124 125 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm
r274894 r276184 181 181 return wkWebAuthenticationType(_panel->clientDataType()); 182 182 } 183 184 - (NSString *)userName 185 { 186 return _panel->userName(); 187 } 188 183 189 #else // ENABLE(WEB_AUTHN) 184 190 - (id <_WKWebAuthenticationPanelDelegate>)delegate -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
r274894 r276184 154 154 } 155 155 156 static String getUserName(const Variant<PublicKeyCredentialCreationOptions, PublicKeyCredentialRequestOptions>& options) 157 { 158 if (WTF::holds_alternative<PublicKeyCredentialCreationOptions>(options)) 159 return WTF::get<PublicKeyCredentialCreationOptions>(options).user.name; 160 return emptyString(); 161 } 162 156 163 } // namespace 157 164 … … 453 460 } 454 461 455 m_pendingRequestData.panel = API::WebAuthenticationPanel::create(*this, getRpId(options), transports, getClientDataType(options) );462 m_pendingRequestData.panel = API::WebAuthenticationPanel::create(*this, getRpId(options), transports, getClientDataType(options), getUserName(options)); 456 463 auto& panel = *m_pendingRequestData.panel; 457 464 page->uiClient().runWebAuthenticationPanel(*page, panel, *frame, FrameInfoData { m_pendingRequestData.frameInfo }, [transports = WTFMove(transports), weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) { … … 481 488 482 489 auto& options = m_pendingRequestData.options; 483 m_presenter = makeUnique<AuthenticatorPresenterCoordinator>(*this, getRpId(options), transports, getClientDataType(options) );490 m_presenter = makeUnique<AuthenticatorPresenterCoordinator>(*this, getRpId(options), transports, getClientDataType(options), getUserName(options)); 484 491 } 485 492 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h
r275370 r276184 40 40 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCSecurityKeyPublicKeyCredentialLoginChoice); 41 41 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCAppleIDCredential); 42 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCPublicKeyCredentialCreationOptions); 42 43 43 44 SOFT_LINK_CONSTANT_FOR_HEADER(WebKit, AuthenticationServicesCore, ASCAuthorizationErrorDomain, NSErrorDomain); -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm
r275370 r276184 40 40 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCSecurityKeyPublicKeyCredentialLoginChoice); 41 41 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAppleIDCredential); 42 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCPublicKeyCredentialCreationOptions); 42 43 43 44 SOFT_LINK_CONSTANT_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAuthorizationErrorDomain, NSErrorDomain); -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h
r271872 r276184 56 56 using CredentialRequestHandler = Function<void(ASCAppleIDCredential *, NSError *)>; 57 57 58 AuthenticatorPresenterCoordinator(const AuthenticatorManager&, const String& rpId, const TransportSet&, WebCore::ClientDataType );58 AuthenticatorPresenterCoordinator(const AuthenticatorManager&, const String& rpId, const TransportSet&, WebCore::ClientDataType, const String& username); 59 59 ~AuthenticatorPresenterCoordinator(); 60 60 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm
r273276 r276184 38 38 using namespace WebCore; 39 39 40 AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator(const AuthenticatorManager& manager, const String& rpId, const TransportSet& transports, ClientDataType type )40 AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator(const AuthenticatorManager& manager, const String& rpId, const TransportSet& transports, ClientDataType type, const String& username) 41 41 : m_manager(makeWeakPtr(manager)) 42 42 { … … 47 47 48 48 switch (type) { 49 case ClientDataType::Create: 49 case ClientDataType::Create: { 50 auto options = adoptNS([allocASCPublicKeyCredentialCreationOptionsInstance() init]); 51 [options setUserName:username]; 52 50 53 if (transports.contains(AuthenticatorTransport::Internal)) 51 [m_context addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice ]).get()];54 [m_context addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoiceWithOptions:options.get()]).get()]; 52 55 if (transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc)) 53 [m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()]; 54 break; 56 [m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoiceWithOptions:options.get()]).get()]; 57 break; 58 } 55 59 case ClientDataType::Get: 56 60 if ((transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc)) && !transports.contains(AuthenticatorTransport::Internal)) -
trunk/Tools/ChangeLog
r276176 r276184 1 2021-04-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 Pass credential name to the WebAuthn UI during registration 4 https://bugs.webkit.org/show_bug.cgi?id=224697 5 <rdar://75803352> 6 7 Reviewed by Brent Fulgham. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: 10 (TestWebKitAPI::TEST): 11 1 12 2021-04-16 Kate Cheney <katherine_cheney@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm
r274894 r276184 492 492 // A bit of extra checks. 493 493 checkPanel([delegate panel], @"", @[adoptNS([[NSNumber alloc] initWithInt:_WKWebAuthenticationTransportUSB]).get()], _WKWebAuthenticationTypeCreate); 494 EXPECT_WK_STREQ([delegate panel].userName, "John Appleseed"); 494 495 } 495 496
Note:
See TracChangeset
for help on using the changeset viewer.