ArcGIS Runtime SDK for iOS: AGSAuthenticationChallenge Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSAuthenticationChallenge Class Reference

Description

Represents an authentication challenge when accessing secured resources.

Instances of this class represent an authentication challenge that was raised because a security error was encountered while trying to access a secured remote resource. You can use AGSAuthenticationManager::setChallengeHandler: in order to register a block for handling all authentication challenges in your app. This block can help centralize your authentication related logic.

To satisfy the challenge, you need to do one of the following -

Since
100
Inheritance diagram for AGSAuthenticationChallenge:

Instance Methods

(void) - cancel
 
(void) - continueWithCredential:
 
(void) - continueWithDefaultHandling
 
(BOOL) - isRemoteResourceFederatedWithPortalURL:
 
(void) - trustHostAndContinue
 

Properties

NSString * authenticatingHost
 
NSError * error
 
NSUInteger failureCount
 
NSURL * portalURL
 
AGSCredentialproposedCredential
 
NSURLProtectionSpace * protectionSpace
 
id< AGSRemoteResourceremoteResource
 
NSURLRequest * request
 
AGSAuthenticationChallengeType type
 

Method Documentation

◆ cancel

- (void) cancel

Cancels performing the operation that led to the authentication challenge, resource will fail to load.

Since
100

◆ continueWithCredential:

- (void) continueWithCredential: (nullable AGSCredential *)  credential

Attempts to continue loading the remoteResource with the provided credential. Continuing with nil will cause the resource to fail to load.

Since
100
See also
proposedCredential

◆ continueWithDefaultHandling

- (void) continueWithDefaultHandling

A default handler will be used which displays UI containing information about the challenge and presents appropriate options to the user.

  • For a challenge of type AGSAuthenticationChallengeTypeUsernamePassword, requests a username and password from the user.
  • For a challenge of type AGSAuthenticationChallengeTypeOAuth, displays the OAuth web page for the user to sign in.
  • For a challenge of type AGSAuthenticationChallengeTypeClientCertificate, allows user to choose a certificate if certificate(s) are available in the keychain, otherwise, browse for the certificate using UIDocumentPickerViewController.
  • For a challenge of type AGSAuthenticationChallengeTypeUntrustedHost, allows user to either trust the host or cancel the challenge.
    Since
    100

◆ isRemoteResourceFederatedWithPortalURL:

- (BOOL) isRemoteResourceFederatedWithPortalURL: (NSURL *)  portalURL

Returns a BOOL indicating whether the remoteResource is federated with speficied portal url.

Since
100

◆ trustHostAndContinue

- (void) trustHostAndContinue

Adds the authenticatingHost to a list of trusted hosts and repeats the web request.

Note
Only use this method if you are confident that the challenge was rasied due to an untrusted server certificate error, otherwise it will raise an exception. You can check type to make sure challenge is for an untrusted server certificate.
Since
100

Property Documentation

◆ authenticatingHost

- (NSString*) authenticatingHost
readnonatomiccopy

The host server of the remoteResource. This is useful to display to a user when prompting them for credentials when a resource fails to load.

Since
100

◆ error

- (NSError*) error
readnonatomicstrong

The underlying security error that led to this authentication challenge.

Since
100

◆ failureCount

- (NSUInteger) failureCount
readnonatomicassign

The number of times this particular challenge has failed.

Since
100

◆ portalURL

- (NSURL*) portalURL
readnonatomicstrong

The portal URL will be avilable when the remote resource is a portal or any federated resource.

Since
100

◆ proposedCredential

- (AGSCredential*) proposedCredential
readnonatomicstrong

An empty credential that has been pre-configured with the authentication scheme being used by the remoteResource. All you need to do is specify is the identity through a username/password, or token, or certificate, and then call continueWithCredential:

Since
100

◆ protectionSpace

- (NSURLProtectionSpace*) protectionSpace
readnonatomicstrong

The security realm of the web request.

Since
100

◆ remoteResource

- (id<AGSRemoteResource>) remoteResource
readnonatomicweak

The secured resource that needs authentication.

Since
100

◆ request

- (NSURLRequest*) request
readnonatomiccopy

The web request used to access the remoteResource that led to this authentication challenge.

Since
100

◆ type

- (AGSAuthenticationChallengeType) type
readnonatomicassign

Type of authentication challenge. This is useful for displaying user interface to user for credentials when a resource fails to load.

Since
100