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 | NSURLCredential.h |
NSURLCredential
is an immutable object representing an authentication credential consisting of the user name, a password and the type of persistent storage to use, if any.
Creates and returns an NSURLCredential
object with a given user name and password using a given persistence setting.
+ (NSURLCredential *)credentialWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence
The user for the credential.
The password for user.
The persistence setting for the credential.
An NSURLCredential
object with user name user, password password, and using persistence setting persistence.
If persistence is NSURLCredentialPersistencePermanent
the credential is stored in the keychain.
NSURLCredential.h
Returns a Boolean value that indicates whether the receiver has a password.
- (BOOL)hasPassword
YES
if the receiver has a password, NO
otherwise.
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.
NSURLCredential.h
Returns an NSURLCredential
object initialized with a given user name and password using a given persistence setting.
- (id)initWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence
The user for the credential.
The password for user.
The persistence setting for the credential.
An NSURLCredential
object initialized with user name user, password password, and using persistence setting persistence.
If persistence is NSURLCredentialPersistencePermanent
the credential is stored in the keychain.
NSURLCredential.h
Returns the receiver’s password.
- (NSString *)password
The receiver’s password.
If the password is stored in the user’s keychain, this method may result in prompting the user for access.
NSURLCredential.h
Returns the receiver’s persistence setting.
- (NSURLCredentialPersistence)persistence
The receiver’s persistence setting.
NSURLCredential.h
Returns the receiver’s user name.
- (NSString *)user
The receiver’s user name.
NSURLCredential.h
These constants specify how long the credential will be kept.
typedef enum { NSURLCredentialPersistenceNone, NSURLCredentialPersistenceForSession, NSURLCredentialPersistencePermanent } NSURLCredentialPersistence;
NSURLCredentialPersistenceNone
Credential won't be stored.
Available in Mac OS X v10.2 and later.
Declared in NSURLCredential.h
.
NSURLCredentialPersistenceForSession
Credential will be stored only for this session.
Available in Mac OS X v10.2 and later.
Declared in NSURLCredential.h
.
NSURLCredentialPersistencePermanent
Credential will be stored in the user’s keychain and shared with other applications.
Available in Mac OS X v10.2 and later.
Declared in NSURLCredential.h
.
NSURLCredential.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)