URLCredentialStorage
The manager of a shared credentials cache.
Declaration
class URLCredentialStorageOverview
The shared cache stores and retrieves instances of URLCredential. You can store password-based credentials permanently, based on the URLCredential.Persistence they were created with. Certificate-based credentials are never stored permanently.
Subclassing notes
The URLCredentialStorage class is meant to be used as-is, but you can subclass it if you have specific needs, such as screening which credentials are stored.
When overriding methods of this class, be aware that methods that take a task parameter are preferred to equivalent methods that do not. Therefore, you should override the task-based methods when subclassing, as follows:
Setting credentials — Override set(_:for:task:) instead of or in addition to set(_:for:).
Getting credentials — Override getCredentials(for:task:completionHandler:) instead of or in addition to credentials(for:).
Removing credentials — Override remove(_:for:options:task:) instead of or in addition to remove(_:for:options:) and remove(_:for:).
Setting default credentials — Override setDefaultCredential(_:for:task:) instead of or in addition to setDefaultCredential(_:for:).
Getting default credentials — Override getDefaultCredential(for:task:completionHandler:) instead of or in addition to defaultCredential(for:).
Topics
Getting the credential storage
Getting and setting default credentials
defaultCredential(for:)getDefaultCredential(for:task:completionHandler:)setDefaultCredential(_:for:)setDefaultCredential(_:for:task:)
Adding and removing credentials
remove(_:for:)remove(_:for:options:)remove(_:for:options:task:)Dictionary key for credential removal optionsset(_:for:)set(_:for:task:)