ArcGIS Runtime SDK for iOS: AGSAuthenticationManager Class Reference
ArcGIS Runtime SDK for iOS  100.5
AGSAuthenticationManager Class Reference

Description

This class allows you to manage authentication/security related events.

It raises an AGSAuthenticationChallenge whenever an authentication or security issue is encountered anywhere in the API. It also provides a default challenge handler which displays UI containing information about the challenge and presents appropriate options to the user, for instance, requesting a username & password. If you want to handle authentication challenges yourself, for example to display your own custom UI, you can provide your own delegate

Note
For challenges related to secure resources that support oAuth, if you provide to the authentication manager a ClientID, the default handler will use the resource's standard oAuth dialog for signing in (as opposed to a generic alert view). See OAuthConfigurations

It also maintains a cache (in memory) of credentials that have been previously used to satisfy authentication challenges. This allows credentials to be reused, where appropriate, and prevent unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm. Additionally, the cache can easily be persisted in the keychain (See enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices: (AGSCredentialCache)) so that if the app is restarted, the cache is automatically pre-populated with saved credentials and the user does not have to sign in again.

Note
When the user wants to log out, you need to explicitly clear the cache by calling removeAllCredentials (AGSCredentialCache)
Since
100
Inheritance diagram for AGSAuthenticationManager:

Class Methods

(instancetype) + sharedAuthenticationManager
 

Properties

AGSCredentialCachecredentialCache
 
id< AGSAuthenticationManagerDelegatedelegate
 
NSMutableArray< AGSOAuthConfiguration * > * OAuthConfigurations
 
NSMutableArray< NSString * > * trustedHosts
 

Method Documentation

§ sharedAuthenticationManager()

+ (instancetype) sharedAuthenticationManager

The singleton instance of authentication manager

Since
100

Property Documentation

§ credentialCache

- (AGSCredentialCache*) credentialCache
readnonatomicstrong

The cache (in-memory) of credentials being maintained by the authentication manager. The cache contains credentials that have been previously used to satisfy authentication challenges. This allows credentials to be reused, where appropriate, and prevent unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm.

The cache can be persisted securely in the keychain (See enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices: (AGSCredentialCache)) so that if the app is restarted, the cache is automatically pre-populated with saved credentials and the user does not have to sign in again.

Note
When the user wants to log out, you need to explicitly clear the cache by calling removeAllCredentials (AGSCredentialCache)
Since
100

§ delegate

- (id<AGSAuthenticationManagerDelegate>) delegate
readwritenonatomicweak

The delegate to be notified whenever any authentication challenges are encountered. This delegate can help centralize all the authentication related logic in your app. If you don't provide a delegate, a default challenge handler will be used to display UI containing information about the challenge and presents appropriate options to the user, for instance, requesting a username & password. You can also use the delegate to customize how the default handler presents UI.

Since
100

§ OAuthConfigurations

- (NSMutableArray<AGSOAuthConfiguration*>*) OAuthConfigurations
readnonatomicstrong

A list of configurations specifying whether OAuth should be used by the default handler to respond to an authentication challenge. If there isn't a configuration that applies to the challenge, the default handler displays a generic view instead of the resource's OAuth login view.

Since
100

§ trustedHosts

- (NSMutableArray<NSString*>*) trustedHosts
readnonatomicstrong

A list of hosts that can be trusted even if they are using self-signed certificates.