NSURLAuthenticationChallenge Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in iOS 2.0 and later. |
| Companion guide | |
| Declared in | NSURLAuthenticationChallenge.h |
Overview
NSURLAuthenticationChallenge encapsulates a challenge from a server requiring authentication from the client.
Tasks
Creating an Authentication Challenge Instance
-
– initWithAuthenticationChallenge:sender: -
– initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:
Getting Authentication Challenge Properties
Instance Methods
error
Returns the NSError object representing the last authentication failure.
Discussion
This method returns nil if the protocol doesn’t use errors to indicate an authentication failure.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
NSURLAuthenticationChallenge.hfailureResponse
Returns the NSURLResponse object representing the last authentication failure.
Discussion
This method will return nil if the protocol doesn’t use responses to indicate an authentication failure.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
NSURLAuthenticationChallenge.hinitWithAuthenticationChallenge:sender:
Returns an initialized NSURLAuthenticationChallenge object copying the properties from challenge, and setting the authentication sender to sender.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
NSURLAuthenticationChallenge.hinitWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:
Returns an initialized NSURLAuthenticationChallenge object for the specified space using the credential, or nil if there is no proposed credential.
Discussion
The previous failure count is set to count. The response should contain the NSURLResponse for the authentication failure, or nil if it is not applicable to the challenge. The error should contain the NSError for the authentication failure, or nil if it is not applicable to the challenge. The object that initiated the authentication challenge is set to sender.
Availability
- Available in iOS 2.0 and later.
Declared In
NSURLAuthenticationChallenge.hpreviousFailureCount
Returns the receiver’s count of failed authentication attempts.
Availability
- Available in iOS 2.0 and later.
Declared In
NSURLAuthenticationChallenge.hproposedCredential
Returns the proposed credential for this challenge.
Discussion
This method will return nil if there is no default credential for this challenge.
If you have previously attempted to authenticate and failed, this method returns the most recent failed credential.
If the proposed credential is not nil and returns YES when sent the message hasPassword, then the credential is ready to use as-is. If the proposed credential returns NO for hasPassword, then the credential provides a default user name and the client must prompt the user for a corresponding password.
Availability
- Available in iOS 2.0 and later.
Declared In
NSURLAuthenticationChallenge.hprotectionSpace
Returns the receiver’s protection space.
Availability
- Available in iOS 2.0 and later.
Declared In
NSURLAuthenticationChallenge.hsender
Returns the receiver’s sender.
Discussion
The sender should be sent a useCredential:forAuthenticationChallenge:, continueWithoutCredentialForAuthenticationChallenge: or cancelAuthenticationChallenge: when the client is finished processing the authentication challenge.
Availability
- Available in iOS 2.0 and later.
Declared In
NSURLAuthenticationChallenge.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-04-06)