Class: NSURLCredential
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)
-
+ credentialForTrust:
Creates and returns an NSURLCredential object for server trust authentication with a given accepted trust.
-
+ credentialWithIdentity:certificates: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.
-
+ credentialWithUser:password:persistence:
Creates and returns an NSURLCredential object for internet password authentication with a given user name and password using a given persistence setting.
Instance Method Summary (collapse)
-
- certificates
Returns an array of SecCertificateRef objects representing the certificates of the credential if it is a client certificate credential.
-
- hasPassword
Returns a Boolean value that indicates whether the receiver has a password.
-
- identity
Returns the identity of this credential if it is a client certificate credential.
-
- initWithIdentity:certificates: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.
-
- initWithTrust:
Returns an NSURLCredential object for server trust authentication initialized with a given accepted trust.
-
- initWithUser:password:persistence:
Returns an NSURLCredential object initialized with a given user name and password using a given persistence setting.
-
- password
Returns the receiver’s password.
-
- persistence
Returns the receiver’s persistence setting.
-
- user
Returns the receiver’s user name.
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:.
+ (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.
+ (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.
Instance Method Details
- (Array) certificates
Returns an array of SecCertificateRef objects representing the certificates of the credential if it is 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.
- (SecIdentityRef) identity
Returns the identity of this credential if it is 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.
- (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:.
- (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.
- (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.
- (NSURLCredentialPersistence) persistence
Returns the receiver’s persistence setting.
- (String) user
Returns the receiver’s user name.