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 | NSURLProtectionSpace.h |
NSURLProtectionSpace represents a server or an area on a server, commonly referred to as a realm, that requires authentication. An NSURLProtectionSpace’s credentials apply to any requests within that protection space.
– initWithHost:port:protocol:realm:authenticationMethod:
– initWithProxyHost:port:type:realm:authenticationMethod:
– authenticationMethod
– host
– isProxy
– port
– protocol
– proxyType
– realm
– receivesCredentialSecurely
Returns the authentication method used by the receiver.
- (NSString *)authenticationMethod
The authentication method used by the receiver. The supported authentication methods are listed in “Constants.”
NSURLProtectionSpace.h
Returns the receiver’s host.
- (NSString *)host
The receiver's host.
NSURLProtectionSpace.h
Initializes a protection space object.
- (id)initWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
The host name for the protection space object.
The port for the protection space object. If port is 0 the default port for the specified protocol is used, for example, port 80 for HTTP. Note that servers can, and do, treat these values differently.
The protocol for the protection space object. The value of protocol is equivalent to the scheme for a URL in the protection space, for example, “http”, “https”, “ftp”, etc.
A string indicating a protocol specific subdivision of the host. realm may be nil
if there is no specified realm or if the protocol doesn’t support realms.
The type of authentication to use. authenticationMethod should be set to one of the values in “Constants” or nil
to use the default, NSURLAuthenticationMethodDefault
.
NSURLProtectionSpace.h
Initializes a protection space object representing a proxy server.
- (id)initWithProxyHost:(NSString *)host port:(NSInteger)port type:(NSString *)proxyType realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
The host of the proxy server for the protection space object.
The port for the protection space object. If port is 0 the default port for the specified proxy type is used, for example, port 80 for HTTP. Note that servers can, and do, treat these values differently.
The type of proxy server. The value of proxyType should be set to one of the values specified in “Constants.”
A string indicating a protocol specific subdivision of the host. realm may be nil
if there is no specified realm or if the protocol doesn’t support realms.
The type of authentication to use. authenticationMethod should be set to one of the values in “Constants” or nil
to use the default, NSURLAuthenticationMethodDefault
.
NSURLProtectionSpace.h
Returns whether the receiver represents a proxy server.
- (BOOL)isProxy
YES
if the receiver represents a proxy server, NO
otherwise.
NSURLProtectionSpace.h
Returns the receiver’s port.
- (NSInteger)port
The receiver's port.
NSURLProtectionSpace.h
Returns the receiver’s protocol.
- (NSString *)protocol
The receiver's protocol, or nil
if the receiver represents a proxy protection space.
NSURLProtectionSpace.h
Returns the receiver's proxy type.
- (NSString *)proxyType
The receiver's proxy type, or nil
if the receiver does not represent a proxy protection space. The supported proxy types are listed in “Constants.”
NSURLProtectionSpace.h
Returns the receiver’s authentication realm
- (NSString *)realm
The receiver’s authentication realm, or nil
if no realm has been set.
A realm is generally only specified for HTTP and HTTPS authentication.
NSURLProtectionSpace.h
Returns whether the credentials for the protection space can be sent securely.
- (BOOL)receivesCredentialSecurely
YES
if the credentials for the protection space represented by the receiver can be sent securely, NO
otherwise.
NSURLProtectionSpace.h
These constants describe the supported proxy types used in initWithProxyHost:port:type:realm:authenticationMethod:
and returned by proxyType
.
extern NSString *NSURLProtectionSpaceHTTPProxy; extern NSString *NSURLProtectionSpaceHTTPSProxy; extern NSString *NSURLProtectionSpaceFTPProxy; extern NSString *NSURLProtectionSpaceSOCKSProxy;
NSURLProtectionSpaceHTTPProxy
The proxy type for HTTP proxies.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLProtectionSpaceHTTPSProxy
The proxy type for HTTPS proxies.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLProtectionSpaceFTPProxy
The proxy type for FTP proxies.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLProtectionSpaceSOCKSProxy
The proxy type for SOCKS proxies.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLProtectionSpace.h
These constants describe the available authentication methods used in initWithHost:port:protocol:realm:authenticationMethod:
, initWithProxyHost:port:type:realm:authenticationMethod:
and returned by authenticationMethod
.
extern NSString *NSURLAuthenticationMethodDefault; extern NSString *NSURLAuthenticationMethodHTTPBasic; extern NSString *NSURLAuthenticationMethodHTTPDigest; extern NSString *NSURLAuthenticationMethodHTMLForm;
NSURLAuthenticationMethodDefault
Use the default authentication method for a protocol.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLAuthenticationMethodHTTPBasic
Use HTTP basic authentication for this protection space.
This is equivalent to NSURLAuthenticationMethodDefault
for HTTP.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLAuthenticationMethodHTTPDigest
Use HTTP digest authentication for this protection space.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLAuthenticationMethodHTMLForm
Use HTML form authentication for this protection space.
This authentication method can apply to any protocol.
Available in Mac OS X v10.2 and later.
Declared in NSURLProtectionSpace.h
.
NSURLProtectionSpace.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)