Skip to content

Commit

Permalink
Replaced SDWebImage#1345 - Added urlCredential property to SDWebImage…
Browse files Browse the repository at this point in the history
…Downloader
  • Loading branch information
bpoplauschi committed Oct 25, 2015
1 parent 3b9c091 commit dcb7985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions SDWebImage/SDWebImageDownloader.h
Expand Up @@ -109,6 +109,11 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi
*/
+ (SDWebImageDownloader *)sharedDownloader;

/**
* Set the default URL credential to be set for request operations.
*/
@property (strong, nonatomic) NSURLCredential *urlCredential;

/**
* Set username
*/
Expand Down
4 changes: 3 additions & 1 deletion SDWebImage/SDWebImageDownloader.m
Expand Up @@ -172,7 +172,9 @@ - (void)setOperationClass:(Class)operationClass {
}];
operation.shouldDecompressImages = wself.shouldDecompressImages;

if (wself.username && wself.password) {
if (wself.urlCredential) {
operation.credential = wself.urlCredential;
} else if (wself.username && wself.password) {
operation.credential = [NSURLCredential credentialWithUser:wself.username password:wself.password persistence:NSURLCredentialPersistenceForSession];
}

Expand Down

0 comments on commit dcb7985

Please sign in to comment.