Changeset 279755 in webkit
- Timestamp:
- Jul 8, 2021, 3:13:59 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r279680 r279755 1 2021-07-08 Brent Fulgham <bfulgham@apple.com> 2 3 [Cocoa] Expose SPI to opt out of Extensible SSO authentication 4 https://bugs.webkit.org/show_bug.cgi?id=227729 5 <rdar://problem/75647892> 6 7 Reviewed by Tim Horton. 8 9 Create new WKPreference to allow WebKit clients to opt out of Extensible SSO authentication. 10 11 * Scripts/Preferences/WebPreferences.yaml: 12 1 13 2021-07-07 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml
r277030 r279755 760 760 default: false 761 761 762 ExtensibleSSOEnabled: 763 type: bool 764 getter: isExtensibleSSOEnabled 765 webcoreBinding: none 766 condition: HAVE(APP_SSO) 767 exposed: [ WebKit ] 768 defaultValue: 769 WebKit: 770 default: true 771 762 772 FTPDirectoryTemplatePath: 763 773 type: String -
trunk/Source/WebKit/ChangeLog
r279751 r279755 1 2021-07-08 Brent Fulgham <bfulgham@apple.com> 2 3 [Cocoa] Expose SPI to opt out of Extensible SSO authentication 4 https://bugs.webkit.org/show_bug.cgi?id=227729 5 <rdar://problem/75647892> 6 7 Reviewed by Tim Horton. 8 9 WKWebView clients should be able to disable Extensible SSO authentication flows, so exposing the internal 10 mechanism as SPI. This is especially important for use cases where a WKWebView will be used to load content 11 without being attached to a Window, since a Window is required to present the Extensible SSO authentication 12 UI. Without a Window, WebKit will wait for a Window to be attached causing loads to timeout. By adopting this 13 API, developers can opt out of Extensible SSO, allowing loads to fail quickly rather than waiting for a timeout. 14 15 Tested by a new TestWebKitAPI test case: SOAuthorizationRedirect.DisableSSO 16 17 * UIProcess/API/Cocoa/WKPreferences.h: 18 * UIProcess/API/Cocoa/WKPreferences.mm: 19 (-[WKPreferences _extensibleSSOEnabled]): Add getter for new preference. 20 (-[WKPreferences _setExtensibleSSOEnabled:]): Add setter. 21 * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: 22 (WebKit::NavigationSOAuthorizationSession::shouldStartInternal): Add new logging so developers can see when a WKWebView 23 without a Window is attempting to participate in Extensible SSO flows. 24 * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm: 25 (WebKit::PopUpSOAuthorizationSession::initSecretWebView): Switch from SPI to API. 26 * UIProcess/WebPageProxy.cpp: 27 (WebKit::WebPageProxy::decidePolicyForNavigationAction): Ditto. 28 * UIProcess/WebPageProxy.h: 29 1 30 2021-07-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 31 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
r275910 r279755 1492 1492 } 1493 1493 1494 - (BOOL)_isExtensibleSSOEnabled 1495 { 1496 #if HAVE(APP_SSO) 1497 return _preferences->isExtensibleSSOEnabled(); 1498 #else 1499 return false; 1500 #endif 1501 } 1502 1503 - (void)_setExtensibleSSOEnabled:(BOOL)extensibleSSOEnabled 1504 { 1505 #if HAVE(APP_SSO) 1506 _preferences->setExtensibleSSOEnabled(extensibleSSOEnabled); 1507 #endif 1508 } 1509 1494 1510 @end 1495 1511 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r279089 r279755 172 172 @property (nonatomic, setter=_setPitchCorrectionAlgorithm:) _WKPitchCorrectionAlgorithm _pitchCorrectionAlgorithm WK_API_AVAILABLE(macos(12.0), ios(15.0)); 173 173 @property (nonatomic, setter=_setMediaSessionEnabled:) BOOL _mediaSessionEnabled WK_API_AVAILABLE(macos(12.0), ios(15.0)); 174 @property (nonatomic, getter=_isExtensibleSSOEnabled, setter=_setExtensibleSSOEnabled:) BOOL _extensibleSSOEnabled WK_API_AVAILABLE(macos(12.0), ios(15.0)); 175 174 176 175 177 #if !TARGET_OS_IPHONE -
trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm
r279305 r279755 58 58 beforeStart(); 59 59 if (!page->isInWindow()) { 60 AUTHORIZATIONSESSION_RELEASE_LOG("shouldStartInternal: Starting Extensible SSO authentication for a web view that is not attached to a window. Loading will pause until a window is attached."); 60 61 setState(State::Waiting); 61 62 page->addObserver(*this); -
trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm
r279305 r279755 190 190 [m_secretWebView setNavigationDelegate:m_secretDelegate.get()]; 191 191 192 m_secretWebView->_page-> setShouldSuppressSOAuthorizationInAllNavigationPolicyDecision();192 m_secretWebView->_page->preferences().setExtensibleSSOEnabled(false); 193 193 WTFLogAlways("SecretWebView is created."); 194 194 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r279750 r279755 5434 5434 else { 5435 5435 #if HAVE(APP_SSO) 5436 if (m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision || m_shouldSuppressSOAuthorizationInAllNavigationPolicyDecision)5436 if (m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision || !m_preferences->isExtensibleSSOEnabled()) 5437 5437 navigationAction->unsetShouldPerformSOAuthorization(); 5438 5438 #endif -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r279750 r279755 1779 1779 1780 1780 #if HAVE(APP_SSO) 1781 void setShouldSuppressSOAuthorizationInAllNavigationPolicyDecision() { m_shouldSuppressSOAuthorizationInAllNavigationPolicyDecision = true; }1782 1781 void setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision() { m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision = true; } 1783 1782 void decidePolicyForSOAuthorizationLoad(const String&, CompletionHandler<void(SOAuthorizationLoadPolicy)>&&); … … 2733 2732 #if HAVE(APP_SSO) 2734 2733 bool m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision { false }; 2735 bool m_shouldSuppressSOAuthorizationInAllNavigationPolicyDecision { false };2736 2734 #endif 2737 2735 -
trunk/Tools/ChangeLog
r279750 r279755 1 2021-07-08 Brent Fulgham <bfulgham@apple.com> 2 3 [Cocoa] Expose SPI to opt out of Extensible SSO authentication 4 https://bugs.webkit.org/show_bug.cgi?id=227729 5 <rdar://problem/75647892> 6 7 Reviewed by Tim Horton. 8 9 Add a new test to confirm that Extenstible SSO authentication flows are bypassed when the new WKPreference 10 is used. Updated other tests to confirm that the SSO delegate is called when expected. 11 12 * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm: 13 (-[TestSOAuthorizationDelegate _webView:decidePolicyForSOAuthorizationLoadWithCurrentPolicy:forExtension:completionHandler:]): 14 (resetState): 15 (TestWebKitAPI::TEST): 16 1 17 2021-07-08 Kate Cheney <katherine_cheney@apple.com> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm
r273308 r279755 1 1 /* 2 * Copyright (C) 2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 #import <WebKit/WKNavigationDelegatePrivate.h> 38 38 #import <WebKit/WKNavigationPrivate.h> 39 #import <WebKit/WKPreferencesPrivate.h> 39 40 #import <WebKit/WKWebViewPrivate.h> 40 41 #import <pal/cocoa/AppSSOSoftLink.h> … … 48 49 49 50 static bool navigationCompleted = false; 51 static bool policyForAppSSOPerformed = false; 50 52 static bool authorizationPerformed = false; 51 53 static bool authorizationCancelled = false; … … 194 196 EXPECT_EQ(policy, _WKSOAuthorizationLoadPolicyAllow); 195 197 EXPECT_TRUE([extension isEqual:@"Test"]); 198 policyForAppSSOPerformed = true; 196 199 if (!self.isAsyncExecution) { 197 200 if (self.allowSOAuthorizationLoad) … … 328 331 { 329 332 navigationCompleted = false; 333 policyForAppSSOPerformed = false; 330 334 authorizationPerformed = false; 331 335 authorizationCancelled = false; … … 385 389 Util::run(&navigationCompleted); 386 390 391 EXPECT_FALSE(policyForAppSSOPerformed); 387 392 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 388 393 } 389 394 395 TEST(SOAuthorizationRedirect, DisableSSO) 396 { 397 resetState(); 398 ClassMethodSwizzler swizzler1(PAL::getSOAuthorizationClass(), @selector(canPerformAuthorizationWithURL:responseCode:), reinterpret_cast<IMP>(overrideCanPerformAuthorizationWithURL)); 399 InstanceMethodSwizzler swizzler2(PAL::getSOAuthorizationClass(), @selector(setDelegate:), reinterpret_cast<IMP>(overrideSetDelegate)); 400 InstanceMethodSwizzler swizzler3(PAL::getSOAuthorizationClass(), @selector(beginAuthorizationWithURL:httpHeaders:httpBody:), reinterpret_cast<IMP>(overrideBeginAuthorizationWithURL)); 401 InstanceMethodSwizzler swizzler4(PAL::getSOAuthorizationClass(), @selector(getAuthorizationHintsWithURL:responseCode:completion:), reinterpret_cast<IMP>(overrideGetAuthorizationHintsWithURL)); 402 403 RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 404 405 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 406 auto preferences = configuration.get().preferences; 407 EXPECT_TRUE(preferences._isExtensibleSSOEnabled); 408 409 preferences._extensibleSSOEnabled = NO; 410 411 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]); 412 auto delegate = adoptNS([[TestSOAuthorizationDelegate alloc] init]); 413 configureSOAuthorizationWebView(webView.get(), delegate.get(), OpenExternalSchemesPolicy::Allow); 414 415 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 416 Util::run(&navigationCompleted); 417 418 EXPECT_FALSE(policyForAppSSOPerformed); 419 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 420 } 421 390 422 TEST(SOAuthorizationRedirect, InterceptionError) 391 423 { … … 403 435 Util::run(&navigationCompleted); 404 436 437 EXPECT_TRUE(policyForAppSSOPerformed); 405 438 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 406 439 } … … 423 456 Util::run(&authorizationPerformed); 424 457 checkAuthorizationOptions(false, "", 0); 458 EXPECT_TRUE(policyForAppSSOPerformed); 425 459 426 460 [gDelegate authorizationDidNotHandle:gAuthorization]; … … 447 481 Util::run(&authorizationPerformed); 448 482 checkAuthorizationOptions(false, "", 0); 483 EXPECT_TRUE(policyForAppSSOPerformed); 449 484 450 485 [gDelegate authorizationDidCancel:gAuthorization]; … … 471 506 Util::run(&authorizationPerformed); 472 507 checkAuthorizationOptions(false, "", 0); 508 EXPECT_TRUE(policyForAppSSOPerformed); 473 509 474 510 [gDelegate authorizationDidComplete:gAuthorization]; … … 495 531 Util::run(&authorizationPerformed); 496 532 checkAuthorizationOptions(false, "", 0); 533 EXPECT_TRUE(policyForAppSSOPerformed); 497 534 498 535 [gDelegate authorization:gAuthorization didCompleteWithHTTPAuthorizationHeaders:adoptNS([[NSDictionary alloc] init]).get()]; … … 520 557 Util::run(&authorizationPerformed); 521 558 checkAuthorizationOptions(false, "", 0); 559 EXPECT_FALSE(policyForAppSSOPerformed); // The delegate isn't registered, so this won't be set. 522 560 #if PLATFORM(MAC) 523 561 EXPECT_TRUE(gAuthorization.enableEmbeddedAuthorizationViewController); … … 564 602 checkAuthorizationOptions(true, "null", 0); 565 603 #endif 604 EXPECT_FALSE(policyForAppSSOPerformed); // The delegate isn't registered, so this won't be set. 566 605 567 606 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 600 639 checkAuthorizationOptions(true, "null", 0); 601 640 #endif 641 EXPECT_TRUE(policyForAppSSOPerformed); 602 642 603 643 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 628 668 Util::run(&authorizationPerformed); 629 669 checkAuthorizationOptions(false, "", 0); 670 EXPECT_TRUE(policyForAppSSOPerformed); 630 671 631 672 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 657 698 Util::run(&authorizationPerformed); 658 699 checkAuthorizationOptions(false, "", 0); 700 EXPECT_TRUE(policyForAppSSOPerformed); 659 701 660 702 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 682 724 Util::run(&authorizationPerformed); 683 725 checkAuthorizationOptions(false, "", 0); 726 EXPECT_TRUE(policyForAppSSOPerformed); 684 727 685 728 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 718 761 Util::run(&authorizationPerformed); 719 762 checkAuthorizationOptions(false, "", 0); 763 EXPECT_TRUE(policyForAppSSOPerformed); 720 764 721 765 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 763 807 checkAuthorizationOptions(true, "null", 0); 764 808 #endif 809 EXPECT_TRUE(policyForAppSSOPerformed); 765 810 766 811 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 795 840 Util::run(&authorizationPerformed); 796 841 checkAuthorizationOptions(false, "", 0); 842 EXPECT_TRUE(policyForAppSSOPerformed); 797 843 798 844 auto redirectURL = URL(URL(), "https://www.example.com"); … … 821 867 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 822 868 Util::run(&navigationPolicyDecided); 869 EXPECT_FALSE(policyForAppSSOPerformed); 823 870 EXPECT_FALSE(authorizationPerformed); 824 871 … … 827 874 Util::run(&authorizationPerformed); 828 875 checkAuthorizationOptions(false, "", 0); 876 EXPECT_TRUE(policyForAppSSOPerformed); 829 877 830 878 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 858 906 [webView loadRequest:[NSURLRequest requestWithURL:testURL1.get()]]; 859 907 Util::run(&navigationPolicyDecided); 908 EXPECT_FALSE(policyForAppSSOPerformed); 860 909 EXPECT_FALSE(authorizationPerformed); 861 910 … … 866 915 // The waiting session should be aborted as the previous navigation is overwritten by a new navigation. 867 916 Util::run(&navigationCompleted); 917 EXPECT_FALSE(policyForAppSSOPerformed); 868 918 EXPECT_FALSE(authorizationPerformed); 869 919 } … … 886 936 Util::run(&authorizationPerformed); 887 937 checkAuthorizationOptions(false, "", 0); 938 EXPECT_TRUE(policyForAppSSOPerformed); 888 939 889 940 // Should be a no op. … … 917 968 for (int i = 0; i < 2; i++) { 918 969 authorizationPerformed = false; 970 policyForAppSSOPerformed = false; 919 971 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 920 972 Util::run(&authorizationPerformed); 921 973 checkAuthorizationOptions(false, "", 0); 974 EXPECT_TRUE(policyForAppSSOPerformed); 922 975 923 976 navigationCompleted = false; … … 952 1005 Util::run(&authorizationPerformed); 953 1006 checkAuthorizationOptions(false, "", 0); 1007 EXPECT_TRUE(policyForAppSSOPerformed); 954 1008 955 1009 // Suppress the last active session. 956 1010 authorizationPerformed = false; 1011 policyForAppSSOPerformed = false; 957 1012 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 958 1013 Util::run(&authorizationCancelled); 959 1014 Util::run(&authorizationPerformed); 960 1015 checkAuthorizationOptions(false, "", 0); 1016 EXPECT_TRUE(policyForAppSSOPerformed); 961 1017 962 1018 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 990 1046 Util::run(&navigationPolicyDecided); 991 1047 EXPECT_FALSE(authorizationPerformed); 1048 EXPECT_FALSE(policyForAppSSOPerformed); 992 1049 993 1050 // Suppress the last waiting session. … … 996 1053 Util::run(&navigationPolicyDecided); 997 1054 EXPECT_FALSE(authorizationPerformed); 1055 EXPECT_FALSE(policyForAppSSOPerformed); 998 1056 999 1057 // Activate the last session. … … 1001 1059 Util::run(&authorizationPerformed); 1002 1060 checkAuthorizationOptions(false, "", 0); 1061 EXPECT_TRUE(policyForAppSSOPerformed); 1003 1062 1004 1063 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 1035 1094 Util::run(&authorizationPerformed); 1036 1095 checkAuthorizationOptions(false, "", 0); 1096 EXPECT_TRUE(policyForAppSSOPerformed); 1037 1097 1038 1098 // Pass a HTTP 200 response with a html to mimic a SAML response. … … 1063 1123 [webView loadRequest:[NSURLRequest requestWithURL:(NSURL *)testURL]]; 1064 1124 Util::run(&authorizationPerformed); 1125 EXPECT_TRUE(policyForAppSSOPerformed); 1065 1126 1066 1127 navigationCompleted = false; … … 1072 1133 authorizationPerformed = false; 1073 1134 navigationPolicyDecided = false; 1135 policyForAppSSOPerformed = false; 1074 1136 [webView _evaluateJavaScriptWithoutUserGesture:@"location = 'http://www.example.com'" completionHandler:nil]; 1075 1137 Util::run(&navigationPolicyDecided); 1138 EXPECT_TRUE(policyForAppSSOPerformed); 1076 1139 } 1077 1140 … … 1095 1158 Util::run(&authorizationPerformed); 1096 1159 checkAuthorizationOptions(true, "http://www.webkit.org", 0); 1160 EXPECT_TRUE(policyForAppSSOPerformed); 1097 1161 } 1098 1162 … … 1113 1177 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1114 1178 Util::run(&authorizationPerformed); 1179 EXPECT_TRUE(policyForAppSSOPerformed); 1115 1180 1116 1181 // Test passes if no crashes. … … 1135 1200 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1136 1201 Util::run(&authorizationPerformed); 1202 EXPECT_TRUE(policyForAppSSOPerformed); 1137 1203 1138 1204 // Test passes if no crashes. … … 1159 1225 Util::run(&navigationCompleted); 1160 1226 1227 EXPECT_TRUE(policyForAppSSOPerformed); 1161 1228 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 1162 1229 } … … 1179 1246 Util::run(&authorizationPerformed); 1180 1247 checkAuthorizationOptions(false, "", 0); 1248 EXPECT_TRUE(policyForAppSSOPerformed); 1181 1249 1182 1250 RetainPtr<NSURL> redirectURL = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; … … 1208 1276 Util::run(&navigationCompleted); 1209 1277 1278 EXPECT_TRUE(policyForAppSSOPerformed); 1210 1279 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 1211 1280 } … … 1230 1299 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1231 1300 Util::run(&authorizationPerformed); 1301 EXPECT_TRUE(policyForAppSSOPerformed); 1232 1302 1233 1303 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1264 1334 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1265 1335 Util::run(&authorizationPerformed); 1336 EXPECT_TRUE(policyForAppSSOPerformed); 1266 1337 1267 1338 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1297 1368 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1298 1369 Util::run(&authorizationPerformed); 1370 EXPECT_TRUE(policyForAppSSOPerformed); 1299 1371 1300 1372 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1330 1402 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1331 1403 Util::run(&authorizationPerformed); 1404 EXPECT_TRUE(policyForAppSSOPerformed); 1332 1405 1333 1406 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1344 1417 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1345 1418 Util::run(&authorizationCancelled); 1419 EXPECT_TRUE(policyForAppSSOPerformed); 1346 1420 Util::run(&authorizationPerformed); 1347 1421 EXPECT_FALSE(uiShowed); … … 1370 1444 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1371 1445 Util::run(&authorizationPerformed); 1446 EXPECT_TRUE(policyForAppSSOPerformed); 1372 1447 1373 1448 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1408 1483 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1409 1484 Util::run(&authorizationPerformed); 1485 EXPECT_TRUE(policyForAppSSOPerformed); 1410 1486 1411 1487 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1440 1516 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1441 1517 Util::run(&authorizationPerformed); 1518 EXPECT_TRUE(policyForAppSSOPerformed); 1442 1519 1443 1520 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1482 1559 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1483 1560 Util::run(&authorizationPerformed); 1561 EXPECT_TRUE(policyForAppSSOPerformed); 1484 1562 1485 1563 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1524 1602 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1525 1603 Util::run(&authorizationPerformed); 1604 EXPECT_TRUE(policyForAppSSOPerformed); 1526 1605 1527 1606 auto viewController1 = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1547 1626 // Load another AppSSO request. 1548 1627 authorizationPerformed = false; 1549 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1550 Util::run(&authorizationPerformed); 1628 policyForAppSSOPerformed = false; 1629 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1630 Util::run(&authorizationPerformed); 1631 EXPECT_TRUE(policyForAppSSOPerformed); 1551 1632 1552 1633 // UI is only dimissed after the hostApp is unhidden. … … 1571 1652 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1572 1653 Util::run(&authorizationPerformed); 1654 EXPECT_TRUE(policyForAppSSOPerformed); 1573 1655 1574 1656 auto viewController = adoptNS([[TestSOAuthorizationViewController alloc] init]); … … 1594 1676 // Load another AppSSO request. 1595 1677 authorizationPerformed = false; 1596 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1597 Util::run(&authorizationPerformed); 1678 policyForAppSSOPerformed = false; 1679 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1680 Util::run(&authorizationPerformed); 1681 EXPECT_TRUE(policyForAppSSOPerformed); 1598 1682 1599 1683 // UI is only dimissed after the hostApp is unhidden. … … 1626 1710 Util::run(&newWindowCreated); 1627 1711 Util::run(&navigationCompleted); 1712 EXPECT_FALSE(policyForAppSSOPerformed); 1628 1713 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 1629 1714 } … … 1654 1739 [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; 1655 1740 Util::run(&newWindowCreated); 1741 EXPECT_FALSE(policyForAppSSOPerformed); 1656 1742 EXPECT_FALSE(authorizationPerformed); 1657 1743 } … … 1677 1763 Util::run(&newWindowCreated); 1678 1764 EXPECT_FALSE(authorizationPerformed); 1765 EXPECT_FALSE(policyForAppSSOPerformed); 1679 1766 } 1680 1767 … … 1706 1793 Util::run(&authorizationPerformed); 1707 1794 checkAuthorizationOptions(true, "file://", 1); 1795 EXPECT_TRUE(policyForAppSSOPerformed); 1708 1796 1709 1797 authorizationPerformed = false; 1710 1798 navigationCompleted = false; 1799 policyForAppSSOPerformed = false; 1711 1800 [gDelegate authorization:gAuthorization didCompleteWithError:adoptNS([[NSError alloc] initWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]).get()]; 1712 1801 Util::run(&newWindowCreated); … … 1714 1803 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 1715 1804 EXPECT_FALSE(authorizationPerformed); // Don't intercept the first navigation in the new window. 1805 EXPECT_FALSE(policyForAppSSOPerformed); 1716 1806 } 1717 1807 … … 1742 1832 Util::run(&authorizationPerformed); 1743 1833 checkAuthorizationOptions(true, "file://", 1); 1834 EXPECT_TRUE(policyForAppSSOPerformed); 1744 1835 1745 1836 // The secret WKWebView needs to be destroyed right the way. … … 1776 1867 Util::run(&authorizationPerformed); 1777 1868 checkAuthorizationOptions(true, "file://", 1); 1869 EXPECT_TRUE(policyForAppSSOPerformed); 1778 1870 1779 1871 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 1813 1905 Util::run(&authorizationPerformed); 1814 1906 checkAuthorizationOptions(true, "file://", 1); 1907 EXPECT_TRUE(policyForAppSSOPerformed); 1815 1908 1816 1909 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 1850 1943 Util::run(&authorizationPerformed); 1851 1944 checkAuthorizationOptions(true, "file://", 1); 1945 EXPECT_TRUE(policyForAppSSOPerformed); 1852 1946 1853 1947 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 1888 1982 Util::run(&authorizationPerformed); 1889 1983 checkAuthorizationOptions(true, "file://", 1); 1984 EXPECT_TRUE(policyForAppSSOPerformed); 1890 1985 1891 1986 // Will fallback to web path. 1892 1987 navigationCompleted = false; 1893 1988 authorizationPerformed = false; 1989 policyForAppSSOPerformed = false; 1894 1990 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL.get() statusCode:400 HTTPVersion:@"HTTP/1.1" headerFields:nil]); 1895 1991 auto resonseHtmlCString = generateHtml(newWindowResponseTemplate, "").utf8(); … … 1899 1995 EXPECT_WK_STREQ(testURL.get().absoluteString, finalURL); 1900 1996 EXPECT_FALSE(authorizationPerformed); 1997 EXPECT_FALSE(policyForAppSSOPerformed); 1901 1998 } 1902 1999 … … 1928 2025 Util::run(&authorizationPerformed); 1929 2026 checkAuthorizationOptions(true, "file://", 1); 2027 EXPECT_TRUE(policyForAppSSOPerformed); 1930 2028 1931 2029 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:@{ @"Set-Cookie" : @"sessionid=38afes7a8;"}]); … … 1960 2058 for (int i = 0; i < 2; i++) { 1961 2059 authorizationPerformed = false; 2060 policyForAppSSOPerformed = false; 1962 2061 #if PLATFORM(MAC) 1963 2062 [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; … … 1967 2066 Util::run(&authorizationPerformed); 1968 2067 checkAuthorizationOptions(true, "file://", 1); 2068 EXPECT_TRUE(policyForAppSSOPerformed); 1969 2069 1970 2070 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2006 2106 Util::run(&authorizationPerformed); 2007 2107 checkAuthorizationOptions(true, "file://", 1); 2108 EXPECT_TRUE(policyForAppSSOPerformed); 2008 2109 2009 2110 // Suppress the last active session. … … 2016 2117 2017 2118 authorizationPerformed = false; 2119 policyForAppSSOPerformed = false; 2018 2120 #if PLATFORM(MAC) 2019 2121 [newWebView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; … … 2024 2126 Util::run(&authorizationPerformed); 2025 2127 checkAuthorizationOptions(true, "file://", 1); 2128 EXPECT_TRUE(policyForAppSSOPerformed); 2026 2129 2027 2130 navigationCompleted = false; … … 2068 2171 Util::run(&authorizationPerformed); 2069 2172 checkAuthorizationOptions(true, "file://", 1); 2173 EXPECT_TRUE(policyForAppSSOPerformed); 2070 2174 2071 2175 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2104 2208 Util::run(&authorizationPerformed); 2105 2209 checkAuthorizationOptions(true, "http://www.webkit.org", 1); 2210 EXPECT_TRUE(policyForAppSSOPerformed); 2106 2211 } 2107 2212 … … 2130 2235 Util::run(&newWindowCreated); 2131 2236 EXPECT_FALSE(authorizationPerformed); 2237 EXPECT_TRUE(policyForAppSSOPerformed); 2132 2238 } 2133 2239 … … 2159 2265 Util::run(&authorizationPerformed); 2160 2266 checkAuthorizationOptions(true, "file://", 1); 2267 EXPECT_TRUE(policyForAppSSOPerformed); 2161 2268 2162 2269 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2196 2303 Util::run(&newWindowCreated); 2197 2304 EXPECT_FALSE(authorizationPerformed); 2305 EXPECT_TRUE(policyForAppSSOPerformed); 2198 2306 } 2199 2307 … … 2211 2319 [webView loadHTMLString:testHtml baseURL:baseURL.get()]; 2212 2320 [webView waitForMessage:@""]; 2321 EXPECT_FALSE(policyForAppSSOPerformed); 2213 2322 } 2214 2323 … … 2232 2341 // Make sure we don't intercept the iframe. 2233 2342 EXPECT_FALSE(authorizationPerformed); 2343 EXPECT_FALSE(policyForAppSSOPerformed); 2234 2344 } 2235 2345 … … 2255 2365 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2256 2366 checkAuthorizationOptions(false, "file://", 2); 2367 EXPECT_TRUE(policyForAppSSOPerformed); 2257 2368 2258 2369 [gDelegate authorization:gAuthorization didCompleteWithError:adoptNS([[NSError alloc] initWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]).get()]; … … 2287 2398 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2288 2399 checkAuthorizationOptions(false, "file://", 2); 2400 EXPECT_TRUE(policyForAppSSOPerformed); 2289 2401 2290 2402 [gDelegate authorizationDidCancel:gAuthorization]; … … 2318 2430 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2319 2431 checkAuthorizationOptions(false, "null", 2); 2432 EXPECT_TRUE(policyForAppSSOPerformed); 2320 2433 2321 2434 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2347 2460 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2348 2461 checkAuthorizationOptions(false, "file://", 2); 2462 EXPECT_TRUE(policyForAppSSOPerformed); 2349 2463 2350 2464 // Will fallback to web path. … … 2382 2496 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2383 2497 checkAuthorizationOptions(false, "null", 2); 2498 EXPECT_TRUE(policyForAppSSOPerformed); 2384 2499 2385 2500 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:@{ @"Set-Cookie" : @"sessionid=38afes7a8;"}]); … … 2409 2524 authorizationPerformed = false; 2410 2525 navigationCompleted = false; 2526 policyForAppSSOPerformed = false; 2411 2527 2412 2528 [webView loadHTMLString:testHtml baseURL:nil]; … … 2414 2530 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2415 2531 checkAuthorizationOptions(false, "null", 2); 2532 EXPECT_TRUE(policyForAppSSOPerformed); 2416 2533 2417 2534 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2464 2581 // Make sure we don't intercept the iframe. 2465 2582 EXPECT_FALSE(authorizationPerformed); 2583 #if PLATFORM(MAC) 2584 EXPECT_TRUE(policyForAppSSOPerformed); 2585 #else 2586 EXPECT_FALSE(policyForAppSSOPerformed); 2587 #endif 2466 2588 } 2467 2589 … … 2487 2609 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2488 2610 checkAuthorizationOptions(false, "null", 2); 2611 EXPECT_TRUE(policyForAppSSOPerformed); 2489 2612 2490 2613 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]); … … 2515 2638 // Make sure we don't intercept the iframe. 2516 2639 EXPECT_FALSE(authorizationPerformed); 2640 #if PLATFORM(MAC) 2641 EXPECT_TRUE(policyForAppSSOPerformed); 2642 #else 2643 EXPECT_FALSE(policyForAppSSOPerformed); 2644 #endif 2517 2645 } 2518 2646 … … 2556 2684 [webView waitForMessage:(id)origin]; 2557 2685 [webView waitForMessage:@"SOAuthorizationDidStart"]; 2686 EXPECT_TRUE(policyForAppSSOPerformed); 2558 2687 2559 2688 [gDelegate authorization:gAuthorization didCompleteWithError:adoptNS([[NSError alloc] initWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]).get()]; … … 2586 2715 [webView loadHTMLString:testHtml baseURL:baseURL.get()]; 2587 2716 Util::run(&authorizationPerformed); 2717 EXPECT_TRUE(policyForAppSSOPerformed); 2588 2718 [gDelegate authorization:gAuthorization didCompleteWithError:adoptNS([[NSError alloc] initWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]).get()]; 2589 2719 Util::run(&allMessagesReceived); … … 2612 2742 [webView loadHTMLString:testHtml baseURL:nil]; 2613 2743 Util::run(&authorizationPerformed); 2744 EXPECT_TRUE(policyForAppSSOPerformed); 2614 2745 2615 2746 auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:testURL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:nil]);
Note:
See TracChangeset
for help on using the changeset viewer.