开发者

Is it possible to reset NSURLConnection after providing credentials?

开发者 https://www.devze.com 2022-12-26 09:31 出处:网络
I am calling a REST service that requires basic auth and I respond to the didReceiveAuthenticationChallenge delegate OK

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

精彩评论

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