Class: NSURLCredential

Inherits:
NSObject show all

Overview

NSURLCredential is an immutable object representing an authentication credential consisting of authentication information specific to the type of credential and the type of persistent storage to use, if any.

Class Method Summary (collapse)

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

Class Method Details

+ (NSURLCredential) credentialForTrust(trust)

Creates and returns an NSURLCredential object for server trust authentication with a given accepted trust. Before creating a server trust credential, it is the responsibility of the delegate of an NSURLConnection object or an NSURLDownload object to evaluate the trust. Do this by calling SecTrustEvaluate, passing it the trust obtained from the serverTrust method of the server’s NSURLProtectionSpace object. If the trust is invalid, the authentication challenge should be cancelled with cancelAuthenticationChallenge:.

Parameters:

  • trust (SecTrustRef)

    The accepted trust.

Returns:

+ (NSURLCredential) credentialWithIdentity(identity, certificates:certArray, persistence:persistence)

Creates and returns an NSURLCredential object for client certificate authentication with a given identity and a given array of client certificates using a given persistence setting.

Parameters:

  • identity (SecIdentityRef)

    The identity for the credential.

  • certArray (Array)

    An array of one or more SecCertificateRef objects representing certificates for the credential.

  • persistence (NSURLCredentialPersistence)

    The persistence setting for the credential.

Returns:

+ (NSURLCredential) credentialWithUser(user, password:password, persistence:persistence)

Creates and returns an NSURLCredential object for internet password authentication with a given user name and password using a given persistence setting. If persistence is NSURLCredentialPersistencePermanent the credential is stored in the keychain.

Parameters:

Returns:

Instance Method Details

- (Array) certificates

Returns an array of SecCertificateRef objects representing the certificates of the credential if it is a client certificate credential.

Returns:

  • (Array)

    The certificates of the credential, or nil if this is not a client certificate credential.

- (Boolean) hasPassword

Returns a Boolean value that indicates whether the receiver has a password. This method does not attempt to retrieve the password.If this credential’s password is stored in the user’s keychain, password may return NO even if this method returns YES, since getting the password may fail, or the user may refuse access.

Returns:

  • (Boolean)

    YES if the receiver has a password, NO otherwise.

- (SecIdentityRef) identity

Returns the identity of this credential if it is a client certificate credential.

Returns:

  • (SecIdentityRef)

    The identity of the credential, or NULL if this is not a client certificate credential.

- (Object) initWithIdentity(identity, certificates:certArray, persistence:persistence)

Returns an NSURLCredential object for client certificate authentication initialized with a given identity and a given array of client certificates using a given persistence setting.

Parameters:

  • identity (SecIdentityRef)

    The identity for the credential.

  • certArray (Array)

    An array of one or more SecCertificateRef objects representing certificates for the credential.

  • persistence (NSURLCredentialPersistence)

    The persistence setting for the credential.

Returns:

- (Object) initWithTrust(trust)

Returns an NSURLCredential object for server trust authentication initialized with a given accepted trust. Before creating a server trust credential, it is the responsibility of the delegate of an NSURLConnection object or an NSURLDownload object to evaluate the trust. Do this by calling SecTrustEvaluate, passing it the trust obtained from the serverTrust method of the server’s NSURLProtectionSpace object. If the trust is invalid, the authentication challenge should be cancelled with cancelAuthenticationChallenge:.

Parameters:

  • trust (SecTrustRef)

    The accepted trust.

Returns:

- (Object) initWithUser(user, password:password, persistence:persistence)

Returns an NSURLCredential object initialized with a given user name and password using a given persistence setting. If persistence is NSURLCredentialPersistencePermanent the credential is stored in the keychain.

Parameters:

Returns:

  • (Object)

    An NSURLCredential object initialized with user name user, password password, and using persistence setting persistence.

- (String) password

Returns the receiver’s password. If the password is stored in the user’s keychain, this method may result in prompting the user for access.

Returns:

  • (String)

    The receiver’s password.

- (NSURLCredentialPersistence) persistence

Returns the receiver’s persistence setting.

Returns:

- (String) user

Returns the receiver’s user name.

Returns:

  • (String)

    The receiver’s user name.