ArcGIS Runtime SDK for iOS: AGSCredential Class Reference
ArcGIS Runtime SDK for iOS  100.7
AGSCredential Class Reference

Description

Represents an credential to access a secured resource.

Instances of this class represent a credential object to access a secured ArcGIS resource. The resource could be secured using ArcGIS tokens or HTTP (basic or digest) authentication.

{AGSCredential.h, ArcGIS}

Since
100
Inheritance diagram for AGSCredential:

Instance Methods

(nullable NSString *) - authenticatingHost
 
(instancetype) - initWithIdentityRef:
 
(instancetype) - initWithToken:referer:
 
(instancetype) - initWithUser:password:
 

Class Methods

(instancetype) + credentialWithUser:password:
 
(nullable NSArray< id > *) + identitiesForProtectionSpace:
 
(nullable SecIdentityRef) + importCertificateData:password:overwrite:error:
 
(OSStatus) + removeIdentityFromKeychain:
 

Properties

BOOL cachingEnabled
 
SecIdentityRef identity
 
NSString * password
 
NSString * referer
 
NSString * token
 
NSURL * tokenUrl
 
NSString * username
 

Method Documentation

§ authenticatingHost()

- (nullable NSString*) authenticatingHost

Returns the host (including port number) that a username/password will be sent to for authentication. This is useful to display to a user when prompting them for credentials when a resource fails to load.

Since
100

§ credentialWithUser:password:()

+ (instancetype) credentialWithUser: (NSString *)  username
password: (NSString *)  password 

Initialize an AGSCredential object.

Parameters
usernameThe username of user attempting to access secured resource.
passwordThe password of user attempting to access secured resource.
Returns
A new, initialized AGSCredential.
Since
100

§ identitiesForProtectionSpace:()

+ (nullable NSArray<id>*) identitiesForProtectionSpace: (nullable NSURLProtectionSpace *)  protectionSpace

Returns an array of SecIdentityRef objects that can be used to authenticate against the specified NSURLProtectionSpace. Pass nil for the protectionSpace to return all identities available to the application.

Parameters
protectionSpaceThe protection space in which to retrieve identities for.
Returns
An array of SecIdentityRef objects that can be used for client certificate authentication.
Since
100

§ importCertificateData:password:overwrite:error:()

+ (nullable SecIdentityRef) importCertificateData: (NSData *)  data
password: (NSString *)  password
overwrite: (BOOL)  overwrite
error: (NSError **)  error 

Imports the certificate data into the keychain for the running application. This certificate can be retrieved from any application that shares the same keychain access group.

Parameters
dataThe data representing the client certificate.
passwordThe password to be used to access the certificate.
overwriteIf YES, this method will delete an existing certificate that matches and then re-add the certificate represented by data.
errorReturned if an error is encountered while importing the data.
Returns
An SecIdentityRef object representing the imported data.
Since
100

§ initWithIdentityRef:()

- (instancetype) initWithIdentityRef: (SecIdentityRef)  identityRef

Initialize an AGSCredential object with an SecIdentityRef.

Parameters
identityRefThe identity in which to initialize the credential object.
Returns
A new, initialized AGSCredential.
Since
100

§ initWithToken:referer:()

- (instancetype) initWithToken: (NSString *)  token
referer: (nullable NSString *)  referer 

Initialize an AGSCredential object with a long-lived token and referer. This token will be used to access the secured resource.

Parameters
tokenThe long-lived token to initialize the credential object.
refererThe referer to be sent along with token in the request.
Returns
A new, initialized AGSCredential.
Since
100

§ initWithUser:password:()

- (instancetype) initWithUser: (NSString *)  username
password: (NSString *)  password 

Initialize an AGSCredential object.

Parameters
usernameThe username of user attempting to access secured resource.
passwordThe password of user attempting to access secured resource.
Returns
A new, initialized AGSCredential.
Since
100

§ removeIdentityFromKeychain:()

+ (OSStatus) removeIdentityFromKeychain: (SecIdentityRef)  identityRef

Removes an identity and its certificates from the keychain.

Parameters
identityRefThe identity to remove from the keychain.
Returns
An OSStatus result code indicating success or failure. See SecBase.h for for possible values.
Since
100

Property Documentation

§ cachingEnabled

- (BOOL) cachingEnabled
readwritenonatomicassign

Specifies whehter credential can be added to the credential cache. Default is YES.

Since
100

§ identity

- (SecIdentityRef) identity
readwritenonatomicassign

The identity associated with this credential.

Since
100

§ password

- (NSString*) password
readwritenonatomiccopy

Password used to access secured resource or retrieve a token.

Since
100

§ referer

- (NSString*) referer
readnonatomiccopy

A string representing the referer for which the long-lived token was generated.

Since
100

§ token

- (NSString*) token
readwritenonatomiccopy

Generated by the server from a username/password combination.

Since
100

§ tokenUrl

- (NSURL*) tokenUrl
readwritenonatomicstrong

Url to the token service.

Since
100

§ username

- (NSString*) username
readwritenonatomiccopy

Username used to access secured resource or retrieve a token.

Since
100