ArcGIS Runtime SDK for iOS: AGSCredentialCache Class Reference
ArcGIS Runtime SDK for iOS  100.12
AGSCredentialCache Class Reference

Description

A cache containing credentials to reuse.

Instances of this class represent a cache containing credentials. Objects that use the same cache could potentially reuse credentials if they need to access the same security realm and a credential for it already exists in the cache.

Since
100
Inheritance diagram for AGSCredentialCache:

Instance Methods

(void) - disableAutoSyncToKeychain
 
(void) - enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:
 
(void) - enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:accessible:
 
(void) - removeAllCredentials
 
(void) - removeAndRevokeAllCredentialsWithCompletion:
 
(void) - removeAndRevokeCredential:completion:
 

Class Methods

(void) + removeFromKeychainWithIdentifier:completion:
 

Properties

BOOL autoSyncToKeychain
 
AGSKeychainItemkeychainItem
 

Method Documentation

◆ disableAutoSyncToKeychain

- (void) disableAutoSyncToKeychain

Disables automatic syncing of credential cache to the keychain. If you want to remove entry from keychain then use removeFromKeychainWithIdentifier:completion:.

Since
100

◆ enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:

- (void) enableAutoSyncToKeychainWithIdentifier: (NSString *)  identifier
accessGroup: (nullable NSString *)  accessGroup
acrossDevices: (BOOL)  acrossDevices 

Enables automatic syncing of credential cache to the keychain. An exception will be raised if identifier is nil or empty. If item is available in the keychain for the specified identifier then it will be fetched from the keychain and replace the contents of the current credential cache. If no item is found with the specified identifier, then current credential cache will be pushed to the keychain. Any changes to the credential cache after auto-syncing is enabled will be pushed to keychain automatically.

Parameters
identifierThe keychain identifier. Must be unique. Cannot be nil.
accessGroupIf you want the credential cache keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil.
acrossDevicesIf you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work.
Since
100

◆ enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:accessible:

- (void) enableAutoSyncToKeychainWithIdentifier: (NSString *)  identifier
accessGroup: (nullable NSString *)  accessGroup
acrossDevices: (BOOL)  acrossDevices
accessible: (AGSKeychainItemAccessible accessible 

Enables automatic syncing of credential cache to the keychain. An exception will be raised if identifier is nil or empty. If item is available in the keychain for the specified identifier then it will be fetched from the keychain and replace the contents of the current credential cache. If no item is found with the specified identifier, then current credential cache will be pushed to the keychain. Any changes to the credential cache after auto-syncing is enabled will be pushed to keychain automatically.

Parameters
identifierThe keychain identifier. Must be unique. Cannot be nil.
accessGroupIf you want the credential cache keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil.
acrossDevicesIf you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work.
accessibleIndicates when a keychain item is accessible. If acrossDevices is YES, the valid options are only those which do not end with ThisDeviceOnly, as those cannot sync to another device. You cannot change this option after the first time you enable auto sync in your app. The keychain item will always be persisted with the option you first provided while enabling auto sync. To change this option, you first have to remove the existing keychain item using removeFromKeychainWithIdentifier:completion:.
Since
100.2

◆ removeAllCredentials

- (void) removeAllCredentials

Removes all AGSCredential objects from the cache.

Since
100

◆ removeAndRevokeAllCredentialsWithCompletion:

- (void) removeAndRevokeAllCredentialsWithCompletion: (nullable void(^)(NSDictionary< AGSCredential *, NSError * > *results))  completion

Removes all credentials from the cache and revokes tokens if appropriate. If any credential is used for OAuth authentication, a request is sent to revoke its OAuth token. All credentials are removed from the cache even if OAuth token revocation fails.

Parameters
completionThe result of the operation. The result contains an NSDictionary that will be empty if no errors occurred. If it's not empty, each entry contains an AGSCredential for which OAuth token revocation failed and an error indicating why it failed.
Since
100.6

◆ removeAndRevokeCredential:completion:

- (void) removeAndRevokeCredential: (AGSCredential *)  credential
completion: (nullable void(^)(NSError *__nullable error))  completion 

Removes the given credential from the credential cache and revokes its token if appropriate. If the credential is used for OAuth authentication, a request is sent to revoke its OAuth token. The credential is removed from the cache even if OAuth token revocation fails.

Parameters
credentialThe credential to be revoked if it's an OAuth token, and removed from the cache.
completionCompletion handler with an error, if any. If the result indicates an error occurred, the error relates to the request to revoke the OAuth token.
Since
100.6

◆ removeFromKeychainWithIdentifier:completion:

+ (void) removeFromKeychainWithIdentifier: (NSString *)  identifier
completion: (nullable void(^)(NSError *__nullable error))  completion 

Removes credential cache from keychain. If automatic syncing of credential cache is enabled for the same keychain identifier then any activity on credential cache will re-add the keychin item. If acrossDevices was true while enabling automatic syncing then it will be honored and iCloud Keychain item will be removed as well.

Since
100

Property Documentation

◆ autoSyncToKeychain

- (BOOL) autoSyncToKeychain
readnonatomicassign

Indicates whether to save credential cache to keychain or not.

See also
- enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:
Since
100

◆ keychainItem

- (AGSKeychainItem*) keychainItem
readnonatomicstrong

Instance of the keychain item if the credential cache is synced with keychain.

See also
- enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices:
Since
100