开发者

Is it possible to reset NSURLConnection after providing credentials?

I am calling a REST service that requires basic auth and I respond to the didReceiveAuthenticationChallenge delegate OK

    NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:self.user password:self.password persistence:NSURLCredentialPersistenceForSession];
    [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
    [credential release];

The Credentials are valid for the Session but I would like for my App to be able to switch between servers and therefore need to "reset" the Session so it asks again for a challenge.

I can of 开发者_高级运维course try the option of not storing the credentials for the Session and supply them for each call but this does not seem like a good idea.

Any ideas would be appreciated!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜