• 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: HTTP (NTLM) authentication with Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP (NTLM) authentication with Cocoa


  • Subject: Re: HTTP (NTLM) authentication with Cocoa
  • From: Jim Luther <email@hidden>
  • Date: Wed, 2 Jul 2008 14:29:49 -0700

Getting Credentials into the CredentialStore for the correct ProtectionSpace will be a problem. For it to be used, the ProtectionSpace in the CredentialStore must be equal to the ProtectionSpace created from the server's authentication challenge.

A ProtectionSpace is consists of the host name, port, server type (protocol, and server or proxy), realm and authentication scheme. While you may know the host name, port, and server type, you probably don't know the realm and authentication scheme -- the realm and authentication scheme come from the server's authentication challenge.

So, if you want to use a server which requires authentication, you'll have to use the APIs that provide for a delegate, or you'll have to pass the credentials in as part of the URL (for example, http://someuser:email@hidden.0.5:42334/ ).


On Jul 2, 2008, at 1:53 PM, Mark Pauley wrote:

Oh right!  Sorry, I should have read your example more carefully.

what you want to use is

- (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace

setCredential will indeed add your credential to the credential store, but it will not be automatically used by NSURLConnection and friends unless you specify that it is the new default credential for that protection space.


_Mark


On Jul 2, 2008, at 1:36 PM, Jens Alfke wrote:


On 1 Jul '08, at 11:52 AM, Mark Pauley wrote:

When your NSURLConnection delegate gets an auth challenge message, you need to send -useCredential:forAuthenticationChallenge: to the connection, or we'll go along on our merry way without checking the credential store again.

He's using +sendSynchronousRequest:, so there's no delegate.
But the synchronous mode should use credentials already in the store, right?


—Jens

_______________________________________________ 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

_______________________________________________ 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
References: 
 >HTTP (NTLM) authentication with Cocoa (From: Niklas Saers <email@hidden>)
 >Re: HTTP (NTLM) authentication with Cocoa (From: Mark Pauley <email@hidden>)
 >Re: HTTP (NTLM) authentication with Cocoa (From: Jens Alfke <email@hidden>)
 >Re: HTTP (NTLM) authentication with Cocoa (From: Mark Pauley <email@hidden>)

  • Prev by Date: Re: HTTP (NTLM) authentication with Cocoa
  • Next by Date: Re: join wifi network
  • Previous by thread: Re: HTTP (NTLM) authentication with Cocoa
  • Next by thread: SOLVED OpenTransport
  • Index(es):
    • Date
    • Thread