An NSURLProtection​Space object represents a server or an area on a server, commonly referred to as a realm, that requires authentication. The 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 URLAuthentication​Challenge 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.


Getting protection space properties

var authentication​Method:​ String

The authentication method used by the receiver.

var distinguished​Names:​ [Data]?

The acceptable certificate-issuing authorities for client certificate authentication.

var host:​ String

The receiver’s host.

var port:​ Int

The receiver’s port.

var `protocol`:​ String?

The receiver’s protocol.

var proxy​Type:​ String?

The receiver's proxy type.

var realm:​ String?

The receiver’s authentication realm

var receives​Credential​Securely:​ Bool

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

var server​Trust:​ Sec​Trust?

A representation of the server’s SSL transaction state.


NSURLProtection​Space Protocol Types

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

Instance Methods