Title: [285056] trunk
Revision
285056
Author
[email protected]
Date
2021-10-29 14:48:15 -0700 (Fri, 29 Oct 2021)

Log Message

Add last modified and creation time to +[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials]
https://bugs.webkit.org/show_bug.cgi?id=232390
<rdar://problem/84689277>

Patch by John Pascoe <[email protected]> on 2021-10-29
Reviewed by Darin Adler.

Source/WebKit:

This change adds new fields to returned credentials useful for providing context about them, namely
when they were created and last modified.

* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(getAllLocalAuthenticatorCredentialsImpl):

Tools:

These fields (creation time and last modified) are useful for providing context about credentials.
The modifications to the tests verify they are properly added.

* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (285055 => 285056)


--- trunk/Source/WebKit/ChangeLog	2021-10-29 21:45:39 UTC (rev 285055)
+++ trunk/Source/WebKit/ChangeLog	2021-10-29 21:48:15 UTC (rev 285056)
@@ -1,3 +1,18 @@
+2021-10-29  John Pascoe  <[email protected]>
+
+        Add last modified and creation time to +[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials]
+        https://bugs.webkit.org/show_bug.cgi?id=232390
+        <rdar://problem/84689277>
+
+        Reviewed by Darin Adler.
+
+        This change adds new fields to returned credentials useful for providing context about them, namely
+        when they were created and last modified.
+
+        * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
+        * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
+        (getAllLocalAuthenticatorCredentialsImpl):
+
 2021-10-29  Cameron McCormack  <[email protected]>
 
         Avoid sending video data to Web process for canvas.drawImage(video).

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h (285055 => 285056)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h	2021-10-29 21:45:39 UTC (rev 285055)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h	2021-10-29 21:48:15 UTC (rev 285056)
@@ -83,6 +83,8 @@
 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialNameKey;
 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialIDKey;
 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialRelyingPartyIDKey;
+WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialLastModificationDateKey;
+WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialCreationDateKey;
 
 @protocol _WKWebAuthenticationPanelDelegate <NSObject>
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm (285055 => 285056)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2021-10-29 21:45:39 UTC (rev 285055)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2021-10-29 21:48:15 UTC (rev 285056)
@@ -99,6 +99,8 @@
 NSString * const _WKLocalAuthenticatorCredentialNameKey = @"_WKLocalAuthenticatorCredentialNameKey";
 NSString * const _WKLocalAuthenticatorCredentialIDKey = @"_WKLocalAuthenticatorCredentialIDKey";
 NSString * const _WKLocalAuthenticatorCredentialRelyingPartyIDKey = @"_WKLocalAuthenticatorCredentialRelyingPartyIDKey";
+NSString * const _WKLocalAuthenticatorCredentialLastModificationDateKey = @"_WKLocalAuthenticatorCredentialLastModificationDateKey";
+NSString * const _WKLocalAuthenticatorCredentialCreationDateKey = @"_WKLocalAuthenticatorCredentialCreationDateKey";
 
 @implementation _WKWebAuthenticationPanel {
 #if ENABLE(WEB_AUTHN)
@@ -248,8 +250,10 @@
 
         [result addObject:@{
             _WKLocalAuthenticatorCredentialNameKey: username,
-            _WKLocalAuthenticatorCredentialIDKey: attributes[bridge_id_cast(kSecAttrApplicationLabel)],
-            _WKLocalAuthenticatorCredentialRelyingPartyIDKey: attributes[bridge_id_cast(kSecAttrLabel)]
+            _WKLocalAuthenticatorCredentialIDKey: attributes[bridge_cast(kSecAttrApplicationLabel)],
+            _WKLocalAuthenticatorCredentialRelyingPartyIDKey: attributes[bridge_cast(kSecAttrLabel)],
+            _WKLocalAuthenticatorCredentialLastModificationDateKey: attributes[bridge_cast(kSecAttrModificationDate)],
+            _WKLocalAuthenticatorCredentialCreationDateKey: attributes[bridge_cast(kSecAttrCreationDate)]
         }];
     }
 

Modified: trunk/Tools/ChangeLog (285055 => 285056)


--- trunk/Tools/ChangeLog	2021-10-29 21:45:39 UTC (rev 285055)
+++ trunk/Tools/ChangeLog	2021-10-29 21:48:15 UTC (rev 285056)
@@ -1,3 +1,17 @@
+2021-10-29  John Pascoe  <[email protected]>
+
+        Add last modified and creation time to +[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials]
+        https://bugs.webkit.org/show_bug.cgi?id=232390
+        <rdar://problem/84689277>
+
+        Reviewed by Darin Adler.
+
+        These fields (creation time and last modified) are useful for providing context about credentials.
+        The modifications to the tests verify they are properly added.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+        (TestWebKitAPI::TEST):
+
 2021-10-29  Alex Christensen  <[email protected]>
 
         Fix macOS clean build after r285047

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (285055 => 285056)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-10-29 21:45:39 UTC (rev 285055)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-10-29 21:48:15 UTC (rev 285056)
@@ -2083,8 +2083,12 @@
 {
     reset();
 
+    auto before = adoptNS([[NSDate alloc] init]);
+
     ASSERT_TRUE(addKeyToKeychain(testES256PrivateKeyBase64, "example.com", testUserEntityBundleBase64));
 
+    auto after = adoptNS([[NSDate alloc] init]);
+
     auto *credentials = [_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentialsWithAccessGroup:@"com.apple.TestWebKitAPI"];
     EXPECT_NOT_NULL(credentials);
     EXPECT_EQ([credentials count], 1lu);
@@ -2094,6 +2098,10 @@
     EXPECT_WK_STREQ([[credentials firstObject][_WKLocalAuthenticatorCredentialIDKey] base64EncodedStringWithOptions:0], "SMSXHngF7hEOsElA73C3RY+8bR4=");
     EXPECT_WK_STREQ([credentials firstObject][_WKLocalAuthenticatorCredentialRelyingPartyIDKey], "example.com");
 
+    EXPECT_GE([[credentials firstObject][_WKLocalAuthenticatorCredentialLastModificationDateKey] compare:before.get()], 0);
+    EXPECT_LE([[credentials firstObject][_WKLocalAuthenticatorCredentialLastModificationDateKey] compare:after.get()], 0);
+    EXPECT_EQ([[credentials firstObject][_WKLocalAuthenticatorCredentialLastModificationDateKey] compare:[credentials firstObject][_WKLocalAuthenticatorCredentialCreationDateKey]], 0);
+
     cleanUpKeychain("example.com");
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to