Permalink
Browse files

[Issue #719] Adding shouldUseCredentialStorage property to AFURLConne…

…ctionOperation /thanks Xihe Yu
  • Loading branch information...
1 parent 1e7c45c commit 9aeb38649b21aba03d2e05aa4f4a25fa73d1815d @mattt mattt committed Jan 7, 2013
Showing with 17 additions and 3 deletions.
  1. +10 −3 AFNetworking/AFURLConnectionOperation.h
  2. +7 −0 AFNetworking/AFURLConnectionOperation.m
View
13 AFNetworking/AFURLConnectionOperation.h
@@ -126,9 +126,16 @@
@property (readonly, nonatomic, assign) NSStringEncoding responseStringEncoding;
-///--------------------------------
-/// @name Accessing URL Credentials
-///--------------------------------
+///-------------------------------
+/// @name Managing URL Credentials
+///-------------------------------
+
+/**
+ Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default.
+
+ @discussion This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`.
+ */
+@property (nonatomic, assign) BOOL shouldUseCredentialStorage;
/**
The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
View
7 AFNetworking/AFURLConnectionOperation.m
@@ -145,6 +145,7 @@ @implementation AFURLConnectionOperation
@dynamic inputStream;
@synthesize outputStream = _outputStream;
@synthesize credential = _credential;
+@synthesize shouldUseCredentialStorage = _shouldUseCredentialStorage;
@synthesize userInfo = _userInfo;
@synthesize backgroundTaskIdentifier = _backgroundTaskIdentifier;
@synthesize uploadProgress = _uploadProgress;
@@ -205,6 +206,8 @@ - (id)initWithRequest:(NSURLRequest *)urlRequest {
self.runLoopModes = [NSSet setWithObject:NSRunLoopCommonModes];
self.request = urlRequest;
+
+ self.shouldUseCredentialStorage = YES;
self.outputStream = [NSOutputStream outputStreamToMemory];
@@ -573,6 +576,10 @@ - (void)connection:(NSURLConnection *)connection
}
}
+- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection __unused *)connection {
+ return self.shouldUseCredentialStorage;
+}
+
- (NSInputStream *)connection:(NSURLConnection __unused *)connection
needNewBodyStream:(NSURLRequest *)request
{

0 comments on commit 9aeb386

Please sign in to comment.