NSURLCredentialStorage Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.2 with Safari 1.0 installed.
Available in OS X v10.2.7 and later.
Companion guide
Declared in
NSURLCredentialStorage.h

Overview

NSURLCredentialStorage implements a singleton (shared object) that manages the credential storage.

Tasks

Getting the Credential Storage

Getting and Setting Default Credentials

Adding and Removing Credentials

Retrieving Credentials

Class Methods

sharedCredentialStorage

Returns the shared URL credential storage object.

+ (NSURLCredentialStorage *)sharedCredentialStorage
Return Value

The shared NSURLCredentialStorage object.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

Instance Methods

allCredentials

Returns a dictionary containing the credentials for all available protection spaces.

- (NSDictionary *)allCredentials
Return Value

A dictionary containing the credentials for all available protection spaces. The dictionary has keys corresponding to the NSURLProtectionSpace objects. The values for the NSURLProtectionSpace keys consist of dictionaries where the keys are user name strings, and the value is the corresponding NSURLCredential object.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

credentialsForProtectionSpace:

Returns a dictionary containing the credentials for the specified protection space.

- (NSDictionary *)credentialsForProtectionSpace:(NSURLProtectionSpace *)protectionSpace
Parameters
protectionSpace

The protection space whose credentials you want to retrieve.

Return Value

A dictionary containing the credentials for protectionSpace. The dictionary’s keys are user name strings, and the value is the corresponding NSURLCredential.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

defaultCredentialForProtectionSpace:

Returns the default credential for the specified protectionSpace.

- (NSURLCredential *)defaultCredentialForProtectionSpace:(NSURLProtectionSpace *)protectionSpace
Parameters
protectionSpace

The URL protection space of interest.

Return Value

The default credential for protectionSpace or nil if no default has been set.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

removeCredential:forProtectionSpace:

Removes a specified credential from the credential storage for the specified protection space.

- (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace
Parameters
credential

The credential to remove.

protectionSpace

The protection space from which to remove the credential.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

setCredential:forProtectionSpace:

Adds credential to the credential storage for the specified protectionSpace.

- (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace
Parameters
credential

The credential to add. If a credential with the same user name already exists in protectionSpace, then credential replaces the existing object.

protectionSpace

The protection space to which to add the credential.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

setDefaultCredential:forProtectionSpace:

Sets the default credential for a specified protection space.

- (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)protectionSpace
Parameters
credential

The URL credential to set as the default for protectionSpace. If the receiver does not contain credential in the specified protectionSpace it will be added.

protectionSpace

The protection space whose default credential is being set.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLCredentialStorage.h

Notifications

NSURLCredentialStorageChangedNotification

This notification is posted when the set of stored credentials changes.

The notification object is the NSURLCredentialStorage instance. This notification does not contain a userInfo dictionary.

Availability
Declared In
NSURLCredentialStorage.h

Did this document help you? Yes It's good, but... Not helpful...