Next Page > Hide TOC

NSURLCredentialStorage Class Reference

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
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
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.