Up

# NSURLProtectionSpace class documentation

### Authors

Generated by root

# Software documentation for the NSURLProtectionSpace class

## NSURLProtectionSpace : NSObject

> Declared in:
>   Foundation/NSURLProtectionSpace.h

> Conforms to:
>   NSCopying

Availability: MacOS-X 10.2.0, Base 1.13.0
Class to encapsulate a protection space... where authentication is required.

Instance Variables
Method summary

- -authenticationMethod
- -host
- -initWithHost:port:protocol:realm:authenticationMethod:
- -initWithProxyHost:port:type:realm:authenticationMethod:
- -isProxy
- -port
- -protocol
- -proxyType
- -realm
- -receivesCredentialSecurely

### authenticationMethod

- (NSString*) authenticationMethod;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the authentication method used for this protection space.

### host

- (NSString*) host;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the host (or proxy host) set in the receiver.

### initWithHost: port: protocol: realm: authenticationMethod:

- (id) initWithHost: (NSString*)host port: (NSInteger)port protocol: (NSString*)protocol realm: (NSString*)realm authenticationMethod: (NSString*)authenticationMethod;
Availability: MacOS-X 10.2.0, Base 1.13.0
Initialises the receiver with host, port, and protocol identifying the protection space. For some protocols the realm identifies a space within the host, for others it may be `nil`.

### initWithProxyHost: port: type: realm: authenticationMethod:

- (id) initWithProxyHost: (NSString*)host port: (NSInteger)port type: (NSString*)type realm: (NSString*)realm authenticationMethod: (NSString*)authenticationMethod;
Availability: MacOS-X 10.2.0, Base 1.13.0
This is like -initWithHost:port:protocol:realm:authenticationMethod: except that it uses a proxy host and proxy type rather than an actual host and a protocol.

### isProxy

- (BOOL) isProxy;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns a flag to indicate whether this protection space is on a proxy server or not.

### port

- (NSInteger) port;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the port set for this receiver or zero if none was set.

### protocol

- (NSString*) protocol;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the protocol of the receiver or `nil` if it is a proxy.

### proxyType

- (NSString*) proxyType;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the proxy type set for the receiver or `nil` if it's not a proxy.

### realm

- (NSString*) realm;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the realm (or `nil`) which was set in the receiver upon initialisation.

### receivesCredentialSecurely

- (BOOL) receivesCredentialSecurely;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns a flag to indicate whether the password for this protection space will be sent over a secure mechanism.

## Instance Variables for NSURLProtectionSpace Class

### _NSURLProtectionSpaceInternal

@protected void* _NSURLProtectionSpaceInternal;
Availability: MacOS-X 10.2.0, Base 1.13.0
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up