• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLDownload and http proxy username/password
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLDownload and http proxy username/password


  • Subject: Re: NSURLDownload and http proxy username/password
  • From: Mark Pauley <email@hidden>
  • Date: Wed, 22 Jun 2011 14:12:51 -0700

I am not 100% sure, but my guess would be the fact that your daemon is running as root.  It could be that the proxy creds are not stored on the system keychain.  Could you try running your daemon as a login user?


On Jun 22, 2011, at 1:20 PM, Elliott wrote:

Just to be sure, I'm running this as a launchd daemon running as root.  This is running on Mac OS.  I now have:

- (BOOL)downloadShouldUseCredentialStorage: (NSURLDownload *)download
{
 return true;
}

then in didReceiveAuthenticationChallenge:

theStorage = [NSURLCredentialStorage sharedCredentialStorage];
NSURLCredential *theCredential = [theStorage defaultCredentialForProtectionSpace: [challenge protectionSpace]];

// this returns NULL

then I tried both useCredential (with the null credential) and also continueWithoutCredentialForAuthenticationChallenge.  I've never seen the keychain dialog come up like it does for Safari.  I looked at the entry in the keychain and it has allow access for: AuthBrokerAgent, Safari, and System Preferences.

Any other ideas?

Thanks,
Elliott


--- On Wed, 6/22/11, Mark Pauley <email@hidden> wrote:

From: Mark Pauley <email@hidden>
Subject: Re: NSURLDownload and http proxy username/password
To: "Elliott" <email@hidden>
Cc: email@hidden
Date: Wednesday, June 22, 2011, 12:13 PM

NSURLConnection will do that for you if you don't tell it not to by returning false from

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection

Are you on iOS or Mac OS here?  On iOS, your app simply doesn't have access to the system keychain, so you will always have to prompt the user for creds at least once.
On Mac OS, if the creds are stored in the system keychain ( which is what system preferences does ), you should get a keychain request dialog for the keychain item.


On Jun 22, 2011, at 12:09 PM, Elliott wrote:

That sounds useful, but the bigger problem I'm having is getting the username and password of the proxy from the System Preferences/Keychain.  I tried getting the credentials using NSURLCredentialStorage but it's empty.  Is there a way to get this information first?

--- On Wed, 6/22/11, Mark Pauley <email@hidden> wrote:

From: Mark Pauley <email@hidden>
Subject: Re: NSURLDownload and http proxy username/password
To: "Elliott" <email@hidden>
Cc: email@hidden
Date: Wednesday, June 22, 2011, 11:32 AM
Have you taken a look at
NSURLCredentialStorage?

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCredentialStorage_Class/Reference/Reference.html

That's the preferred way of storing creds in the
keychain.  In the event that there is no default cred
in the storage, you'll need to put up an auth dialog. 
Just make sure you store the credential you get from the
dialog in your credential storage.


On Jun 22, 2011, at 10:09 AM, Elliott wrote:

I'm still trying to get NSURLDownload working with
username and password.  I have it working without
username and password, but when I add a username and
password and proxy server requires password, it doesn't Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSURLDownload and http proxy username/password
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
References: 
 >Re: NSURLDownload and http proxy username/password (From: Elliott <email@hidden>)

  • Prev by Date: Re: NSURLDownload and http proxy username/password
  • Next by Date: Re: NSURLDownload and http proxy username/password
  • Previous by thread: Re: NSURLDownload and http proxy username/password
  • Next by thread: Re: NSURLDownload and http proxy username/password
  • Index(es):
    • Date
    • Thread