Class

NSURLCredential

An authentication credential consisting of information specific to the type of credential and the type of persistent storage to use, if any.

Overview

The URL Loading System supports password-based user credentials, certificate-based user credentials, and certificate-based server credentials.

When you create a credential, you can specify it for a single request, persist it temporarily (until your app quits), or persist it permanently. Permanent persistence can be local persistence in the keychain, or synchronized persistence across the user's devices, based on their Apple ID.

Topics

Creating a Credential

credentialForTrust:

Creates a URL credential instance for server trust authentication with a given accepted trust.

credentialWithUser:password:persistence:

Creates a URL credential instance for internet password authentication with a given user name and password, using a given persistence setting.

credentialWithIdentity:certificates:persistence:

Creates a URL credential instance for client certificate authentication with a given identity and array of client certificates, using a given persistence setting.

initWithIdentity:certificates:persistence:

Creates a URL credential instance for client certificate authentication, initialized with a given identity and a given array of client certificates, using a given persistence setting.

initWithTrust:

Creates a URL credential instance for server trust authentication, initialized with a accepted trust.

initWithUser:password:persistence:

Creates a URL credential instance initialized with a given user name and password, using a given persistence setting.

NSURLCredentialPersistence

Constants that specify how long the credential will be kept.

Getting Credential Properties

user

The credential’s user name.

certificates

The certificates of the credential, if it is a client certificate credential.

hasPassword

A Boolean value that indicates whether the credential has a password.

password

The credential’s password.

identity

The identity of this credential if it is a client certificate credential.

persistence

The credential’s persistence setting.

NSURLCredentialPersistence

Constants that specify how long the credential will be kept.

Relationships

Inherits From

See Also

Authentication and Credentials

Handling an Authentication Challenge

Respond appropriately when a server demands authentication for a URL request.

NSURLAuthenticationChallenge

A challenge from a server requiring authentication from the client.

NSURLCredentialStorage

The manager of a shared credentials cache.

NSURLProtectionSpace

A server or an area on a server, commonly referred to as a realm, that requires authentication.