My HTTP server isn't returning a WWW-Authenticate
header.
My server's response:
HTTP/1.1 401 Unauthorized
Date: Wed, 19 Jun 2013 14:43:30 GMT
Server: Apache-Coyote/1.1
Expires: Wed, 19 Jun 2013 14:43:30 GMT
Vary: Accept-Encoding,User-Agent
Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0
Content-Length: 0
Content-Type: text/plain
Another server response with a WWW-Authenticate
header:
HTTP/1.1 401 Authorization Required
Date: Wed, 19 Jun 2013 14:44:47 GMT
Server: Apache/2.2.17 (CentOS)
WWW-Authenticate: Basic realm="[LDAP/PROD] Active Directory"
Content-Length: 0
Connection: close
Content-Type: text/plain
It looks like NSURLConnection
requires the WWW-Authenticate
header in its response for it to call NSURLConnectionDelegate
's authentication callbacks.
I've filed a radar about this. Please duplicate it.
Apparently, I'll have to manually set the Authorization
header since NSURLConnection
will not allow you to proactively authenticate with NSURLCredential
.