Class

NSURLProtectionSpace

A server or an area on a server, commonly referred to as a realm, that requires authentication.

Declaration

@interface NSURLProtectionSpace : NSObject

Overview

A protection space defines a series of matching constraints that determine which credential should be provided. For example, if a request provides your delegate with an NSURLAuthenticationChallenge object that requests a client username and password, your app should provide the correct username and password for the particular host, port, protocol, and realm, as specified in the challenge’s protection space.

Topics

Creating a Protection Space

- initWithHost:port:protocol:realm:authenticationMethod:

Creates a protection space object from the given host, port, protocol, realm, and authentication method.

- initWithProxyHost:port:type:realm:authenticationMethod:

Creates a protection space object representing a proxy server.

Getting Protection Space Properties

authenticationMethod

The authentication method used by the receiver.

distinguishedNames

The acceptable certificate-issuing authorities for client certificate authentication.

host

The receiver’s host.

isProxy

A Boolean value that indicates whether the receiver represents a proxy server.

port

The receiver’s port.

protocol

The receiver’s protocol.

proxyType

The receiver's proxy type.

realm

The receiver’s authentication realm

receivesCredentialSecurely

A Boolean value that indicates whether the credentials for the protection space can be sent securely.

serverTrust

A representation of the server’s SSL transaction state.

Identifying Protection Space Properties

NSURLProtectionSpace Protocol Types

These constants describe the supported protocols for a protection space, as returned by protocol.

NSURLProtectionSpace Proxy Types

These constants describe the supported proxy types used in initWithProxyHost:port:type:realm:authenticationMethod: and returned by proxyType.

Relationships

Inherits From

See Also

Authentication and Credentials

Handling an Authentication Challenge

Respond appropriately when a server demands authentication for a URL request.

NSURLAuthenticationChallenge

A challenge from a server requiring authentication from the client.

NSURLCredential

An authentication credential consisting of information specific to the type of credential and the type of persistent storage to use, if any.

NSURLCredentialStorage

The manager of a shared credentials cache.