Class

URLProtectionSpace

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

Declaration

class URLProtectionSpace : 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 a URLAuthenticationChallenge 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

init(host: String, port: Int, protocol: String?, realm: String?, authenticationMethod: String?)

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

Getting Protection Space Properties

var authenticationMethod: String

The authentication method used by the receiver.

var distinguishedNames: [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 proxyType: String?

The receiver's proxy type.

var realm: String?

The receiver’s authentication realm

var receivesCredentialSecurely: Bool

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

var serverTrust: SecTrust?

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 init(proxyHost:port:type:realm:authenticationMethod:) and returned by proxyType.

Instance Methods

Relationships

Inherits From

See Also

Authentication and Credentials

Handling an Authentication Challenge

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

class URLAuthenticationChallenge

A challenge from a server requiring authentication from the client.

class URLCredential

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

class URLCredentialStorage

The manager of a shared credentials cache.