Instance Method

connection:canAuthenticateAgainstProtectionSpace:

Sent to determine whether the delegate is able to respond to a protection space’s form of authentication.

Declaration

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;

Parameters

connection

The connection sending the message.

protectionSpace

The protection space that generates an authentication challenge.

Return Value

YES if the delegate if able to respond to a protection space’s form of authentication, otherwise NO.

Discussion

This method is called before connection:didReceiveAuthenticationChallenge:, allowing the delegate to inspect a protection space before attempting to authenticate against it. By returning YES, the delegate indicates that it can handle the form of authentication, which it does in the subsequent call to connection:didReceiveAuthenticationChallenge:. If the delegate returns NO, the system attempts to use the user’s keychain to authenticate. If your delegate does not implement this method and the protection space uses client certificate authentication or server trust authentication, the system behaves as if you returned NO. The system behaves as if you returned YES for all other authentication methods.

See Also

Connection Authentication

- connection:willSendRequestForAuthenticationChallenge:

Tells the delegate that the connection will send a request for an authentication challenge.

- connection:didCancelAuthenticationChallenge:

Sent when a connection cancels an authentication challenge.

Deprecated
- connection:didReceiveAuthenticationChallenge:

Sent when a connection must authenticate a challenge in order to download its request.

Deprecated
- connectionShouldUseCredentialStorage:

Sent to determine whether the URL loader should use the credential storage for authenticating the connection.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software