Revision: 29569
          http://sourceforge.net/p/bibdesk/svn/29569
Author:   hofman
Date:     2025-09-09 16:31:45 +0000 (Tue, 09 Sep 2025)
Log Message:
-----------
support authentication for web downloads

Modified Paths:
--------------
    trunk/bibdesk/BDSKDownloadManager.m

Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2025-09-09 16:12:21 UTC (rev 29568)
+++ trunk/bibdesk/BDSKDownloadManager.m 2025-09-09 16:31:45 UTC (rev 29569)
@@ -39,6 +39,7 @@
 #import "BDSKDownloadManager.h"
 #import <WebKit/WebKit.h>
 #import "BDSKDownloader.h"
+#import "BDSKAuthenticationHandler.h"
 #import "BDSKStringConstants.h"
 #import "NSURL_BDSKExtensions.h"
 #import "NSFileManager_BDSKExtensions.h"
@@ -430,6 +431,17 @@
     return YES;
 }
 
+- (void)download:(NSURLDownload *)download 
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
+    [[BDSKAuthenticationHandler sharedHandler] startAuthentication:challenge 
window:nil completionHandler:^(NSURLSessionAuthChallengeDisposition 
disposition, NSURLCredential *credential){
+        if (disposition == NSURLSessionAuthChallengeUseCredential)
+            [[challenge sender] useCredential:credential 
forAuthenticationChallenge:challenge];
+        else if (disposition == 
NSURLSessionAuthChallengePerformDefaultHandling)
+            [[challenge sender] 
continueWithoutCredentialForAuthenticationChallenge:challenge];
+        else if (disposition == 
NSURLSessionAuthChallengeCancelAuthenticationChallenge)
+            [download cancel];
+    }];
+}
+
 @end
 
 #pragma mark -
@@ -452,6 +464,10 @@
     }];
 }
 
+- (void)download:(WKDownload *)download 
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge 
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, 
NSURLCredential *))completionHandler API_AVAILABLE(macos(11.3)) {
+    [[BDSKAuthenticationHandler sharedHandler] startAuthentication:challenge 
window:[[download webView] window] completionHandler:completionHandler];
+}
+
 @end
 
 #pragma mark -

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to