Class: NSURLProtectionSpace

Inherits:
NSObject show all

Overview

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.

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Method Details

- (String) authenticationMethod

Returns the authentication method used by the receiver.

Returns:

  • (String)

    The authentication method used by the receiver. The supported authentication methods are listed in “Constants.”

- (Array) distinguishedNames

Returns an array of acceptable certificate-issuing authorities for client certificate authentication. The returned issuing authorities are encoded with Distinguished Encoding Rules (DER).

Returns:

  • (Array)

    An array of acceptable certificate-issuing authorities, or nil if the authentication method of the protection space is not client certificate.

- (String) host

Returns the receiver’s host.

Returns:

  • (String)

    The receiver’s host.

- (Object) initWithHost(host, port:port, protocol:protocol, realm:realm, authenticationMethod:authenticationMethod)

Initializes a protection space object.

Parameters:

  • host (String)

    The host name for the protection space object.

  • port (Integer)

    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.

  • protocol (String)

    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.

  • realm (String)

    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.

  • authenticationMethod (String)

    The type of authentication to use. authenticationMethod should be set to one of the values in “Constants” or nil to use the default, NSURLAuthenticationMethodDefault.

Returns:

- (Object) initWithProxyHost(host, port:port, type:proxyType, realm:realm, authenticationMethod:authenticationMethod)

Initializes a protection space object representing a proxy server.

Parameters:

  • host (String)

    The host of the proxy server for the protection space object.

  • port (Integer)

    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.

  • proxyType (String)

    The type of proxy server. The value of proxyType should be set to one of the values specified in “Constants.”

  • realm (String)

    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.

  • authenticationMethod (String)

    The type of authentication to use. authenticationMethod should be set to one of the values in “Constants” or nil to use the default, NSURLAuthenticationMethodDefault.

Returns:

- (Boolean) isProxy

Returns whether the receiver represents a proxy server.

Returns:

  • (Boolean)

    YES if the receiver represents a proxy server, NO otherwise.

- (Integer) port

Returns the receiver’s port.

Returns:

  • (Integer)

    The receiver’s port.

- (String) protocol

Returns the receiver’s protocol.

Returns:

  • (String)

    The receiver’s protocol, or nil if the receiver represents a proxy protection space.

- (String) proxyType

Returns the receiver's proxy type.

Returns:

  • (String)

    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.”

- (String) realm

Returns the receiver’s authentication realm A realm is generally only specified for HTTP and HTTPS authentication.

Returns:

  • (String)

    The receiver’s authentication realm, or nil if no realm has been set.

- (Boolean) receivesCredentialSecurely

Returns whether the credentials for the protection space can be sent securely.

Returns:

  • (Boolean)

    YES if the credentials for the protection space represented by the receiver can be sent securely, NO otherwise.

- (SecTrustRef) serverTrust

Returns a representation of the server’s SSL transaction state.

Returns:

  • (SecTrustRef)

    The server’s SSL transaction state, or nil if the authentication method of the protection space is not server trust.