TSKNSURLSessionDelegateProxy.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. TSKNSURLSessionDelegateProxy.h
  3. TrustKit
  4. Copyright 2015 The TrustKit Project Authors
  5. Licensed under the MIT license, see associated LICENSE file for terms.
  6. See AUTHORS file for the list of project authors.
  7. */
  8. #if __has_feature(modules)
  9. @import Foundation;
  10. #else
  11. #import <Foundation/Foundation.h>
  12. #endif
  13. NS_ASSUME_NONNULL_BEGIN
  14. @class TrustKit;
  15. typedef void(^TSKURLSessionAuthChallengeCallback)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential);
  16. @interface TSKNSURLSessionDelegateProxy : NSObject
  17. + (void)swizzleNSURLSessionConstructors:(TrustKit *)trustKit;
  18. - (instancetype)init NS_UNAVAILABLE;
  19. - (instancetype _Nullable)initWithTrustKit:(TrustKit *)trustKit sessionDelegate:(id<NSURLSessionDelegate>)delegate NS_DESIGNATED_INITIALIZER;
  20. - (void)URLSession:(NSURLSession *)session
  21. didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
  22. completionHandler:(TSKURLSessionAuthChallengeCallback)completionHandler;
  23. - (void)URLSession:(NSURLSession *)session
  24. task:(NSURLSessionTask *)task
  25. didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
  26. completionHandler:(TSKURLSessionAuthChallengeCallback)completionHandler;
  27. // Forward messages to the original delegate if the proxy doesn't implement the method
  28. - (id)forwardingTargetForSelector:(SEL)sel;
  29. @end
  30. NS_ASSUME_NONNULL_END