Next Page > Hide TOC

NSURLAuthenticationChallenge Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in Mac OS X v10.2 with Safari 1.0 installed.
Available in Mac OS X v10.2.7 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

Getting Authentication Challenge Properties

Instance Methods

error

Returns the NSError object representing the last authentication failure.

- (NSError *)error

Discussion

This method returns nil if the protocol doesn’t use errors to indicate an authentication failure.

Availability
See Also
Declared In
NSURLAuthenticationChallenge.h

failureResponse

Returns the NSURLResponse object representing the last authentication failure.

- (NSURLResponse *)failureResponse

Discussion

This method will return nil if the protocol doesn’t use responses to indicate an authentication failure.

Availability
See Also
Declared In
NSURLAuthenticationChallenge.h

initWithAuthenticationChallenge:sender:

Returns an initialized NSURLAuthenticationChallenge object copying the properties from challenge, and setting the authentication sender to sender.

- (id)initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge sender:(id < NSURLAuthenticationChallengeSender >)sender

Availability
See Also
Declared In
NSURLAuthenticationChallenge.h

initWithProtectionSpace: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.

- (id)initWithProtectionSpace:(NSURLProtectionSpace *)space proposedCredential:(NSURLCredential *)credential previousFailureCount:(NSInteger)count failureResponse:(NSURLResponse *)response error:(NSError *)error sender:(id < NSURLAuthenticationChallengeSender >)sender

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
See Also
Declared In
NSURLAuthenticationChallenge.h

previousFailureCount

Returns the receiver’s count of failed authentication attempts.

- (NSInteger)previousFailureCount

Availability
Declared In
NSURLAuthenticationChallenge.h

proposedCredential

Returns the proposed credential for this challenge.

- (NSURLCredential *)proposedCredential

Discussion

This method will return nil if there is no default credential for this challenge.

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
Declared In
NSURLAuthenticationChallenge.h

protectionSpace

Returns the receiver’s protection space.

- (NSURLProtectionSpace *)protectionSpace

Availability
Declared In
NSURLAuthenticationChallenge.h

sender

Returns the receiver’s sender.

- (id < NSURLAuthenticationChallengeSender >)sender

Discussion

The sender should be sent a useCredential:forAuthenticationChallenge:, continueWithoutCredentialForAuthenticationChallenge: or cancelAuthenticationChallenge: when the client is finished processing the authentication challenge.

Availability
Declared In
NSURLAuthenticationChallenge.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.