Up

# NSURLCredential class documentation

### Authors

Richard Frith-Macdonald (`frm@gnu.org`)

Date: Generated at 2025-02-13 06:02:40 +0000

Copyright: (C) 2006 Software Foundation, Inc.

# Software documentation for the NSURLCredential class

## NSURLCredential : NSObject

> Declared in:
>   Foundation/NSURLCredential.h

> Conforms to:
>   NSCopying

Availability: MacOS-X 10.2.0, Base 1.13.0
Represents a user/password credential

Instance Variables
Method summary

- +credentialWithUser:password:persistence:
- -hasPassword
- -initWithUser:password:persistence:
- -isEqual:
- -password
- -persistence
- -user

### credentialWithUser: password: persistence:

+ (NSURLCredential*) credentialWithUser: (NSString*)user password: (NSString*)password persistence: (NSURLCredentialPersistence)persistence;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns an autoreleased instance initialised using the -initWithUser:password:persistence: method.

### hasPassword

- (BOOL) hasPassword;
Availability: MacOS-X 10.2.0, Base 1.13.0
Determine whether the credential has a password.

### initWithUser: password: persistence:

- (id) initWithUser: (NSString*)user password: (NSString*)password persistence: (NSURLCredentialPersistence)persistence;
Availability: MacOS-X 10.2.0, Base 1.13.0
This is a designated initialiser for the class.
Initialises and returns the receiver with a user name and password.
The user identifies the credential and must be specified but the password may be `nil`.

### isEqual:

- (BOOL) isEqual: (id)other;
Availability: MacOS-X 10.2.0, Base 1.13.0
Tests two credentials for equality... credentials are considered to be equal if their -user methods return the same value, since you cannot have more than one credential for a suser within an NSURLProtectionSpace .

### password

- (NSString*) password;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the password for the receiver.
May require prompting of the user to authorize retrieval.
May return `nil` if retrieval of the password fails (eg authorization failure) even if the credential actually has a password. Call the -hasPassword method to determine whether the credential has a password

### persistence

- (NSURLCredentialPersistence) persistence;
Availability: MacOS-X 10.2.0, Base 1.13.0
Return the presistence of this credential.

### user

- (NSString*) user;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the user string for the receiver

## Instance Variables for NSURLCredential Class

### _NSURLCredentialInternal

@protected void* _NSURLCredentialInternal;
Availability: MacOS-X 10.2.0, Base 1.13.0
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up