我有一个使用 ADFS 保护的 Web 应用程序,以前是 NTLM。我们曾经能够使用 ASIHTTPRequest 类检索数据,但它似乎不适用于 ADFS。响应是对登录 url 的重定向。
这是从 iOS 连接到受 ADFS 保护的 URL 的正确方法吗?
NSURL *url = [NSURL URLWithString:@"https://URL_TO_WCF_SERVICE"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"Basic %@",[ASIHTTPRequest base64forData:[[NSString stringWithFormat:@"%@:%@",userName, password] dataUsingEncoding:NSUTF8StringEncoding]]]];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
NSLog(@"%@", response);
}