From d0b4f72d83d201fb6f6218a6876e06d0b519f804 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 26 Sep 2013 07:16:37 -0700 Subject: [PATCH] [Issue #1366] Adding shouldUseCredentialStorage and credential properties to AFHTTPRequestOperationManager --- AFNetworking/AFHTTPRequestOperationManager.h | 18 ++++++++++++++++++ AFNetworking/AFHTTPRequestOperationManager.m | 2 ++ 2 files changed, 20 insertions(+) diff --git a/AFNetworking/AFHTTPRequestOperationManager.h b/AFNetworking/AFHTTPRequestOperationManager.h index 7652a28..cb6fe2e 100644 --- a/AFNetworking/AFHTTPRequestOperationManager.h +++ b/AFNetworking/AFHTTPRequestOperationManager.h @@ -108,6 +108,24 @@ */ @property (nonatomic, strong) NSOperationQueue *operationQueue; +///------------------------------- +/// @name Managing URL Credentials +///------------------------------- + +/** + Whether request operations should consult the credential storage for authenticating the connection. `YES` by default. + + @see AFURLConnectionOperation -shouldUseCredentialStorage + */ +@property (nonatomic, assign) BOOL shouldUseCredentialStorage; + +/** + The credential used by request operations for authentication challenges. + + @see AFURLConnectionOperation -credential + */ +@property (nonatomic, strong) NSURLCredential *credential; + ///------------------------------- /// @name Managing Security Policy ///------------------------------- diff --git a/AFNetworking/AFHTTPRequestOperationManager.m b/AFNetworking/AFHTTPRequestOperationManager.m index 3a30cc2..06775bc 100644 --- a/AFNetworking/AFHTTPRequestOperationManager.m +++ b/AFNetworking/AFHTTPRequestOperationManager.m @@ -101,6 +101,8 @@ { AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; operation.responseSerializer = self.responseSerializer; + operation.shouldUseCredentialStorage = self.shouldUseCredentialStorage; + operation.credential = self.credential; operation.securityPolicy = self.securityPolicy; [operation setCompletionBlockWithSuccess:success failure:failure];