Hi all,
Disclaimer: I'm not very familiar with the HTTP protocol or network programming, but I have to interact with a SOAP web service that uses Integrated Windows Authentication (IWA). I've used SudzC for another SOAP service before, so I'm trying to use it
here as well, but I'm not getting back any authentication challenge from the web service when it attempts to make a regular NSURLConnection. So I thought I'd try to add the authentication information to the initial request, but I'm running into problems. I'm
using OS X 10.8, Xcode 4.4, the latest OS X SDK (10.8), and have the deployment target set to OS X 10.7. Here is an example of the code I'm using to add the authentication information:
#import
<Foundation/Foundation.h>
#import
<CFNetwork/CFNetwork.h>
int main(int argc,
const char * argv[])
{
@autoreleasepool {
// The URL
NSURL *url = "">NSURL
URLWithString:@"http://someschool.edu/Endpoint.svc"];
// Create the request
NSMutableURLRequest* request = [NSMutableURLRequest
requestWithURL:url];
// Add authentication
CFHTTPMessageRef dummyRequest =
CFHTTPMessageCreateRequest(
kCFAllocatorDefault,
CFSTR("GET"),
(CFURLRef)[request
URL],
kCFHTTPVersion1_1);
Boolean result;
result =
CFHTTPMessageAddAuthentication(
dummyRequest,
NULL,
NULL,
NULL,
kCFHTTPAuthenticationSchemeKerberos,
FALSE);
if (result) {
NSLog(@"success");
} else {
NSLog(@"failure");
}
NSString *authorizationString =
(NSString
*)CFHTTPMessageCopyHeaderFieldValue(
dummyRequest,
CFSTR("Authorization"));
CFRelease(dummyRequest);
[request setValue:authorizationString
forHTTPHeaderField:@"Authorization"];
But this fails to build:
Undefined symbols for architecture x86_64:
"_kCFHTTPAuthenticationSchemeKerberos", referenced from:
_main in main.o
Is this just a bug? I see kCFHTTPAuthenticationSchemeKerberos is declared in CFHTTPMessage.h.
Additionally, are there any tutorials or documentation regarding Kerberos authentication like this or how to use the Negotiate or Negotiate2 schemes? Is there a way to do this strictly with NSURLRequest and NSConnection objects?
Thanks for the help.
--
John Anthony Grigutis
Systems Analyst/Programmer/Mac Specialist
UITS Support Systems, Licensing, & Software Distribution
|