Package com.esri.arcgisruntime.security
Class Credential
- java.lang.Object
-
- com.esri.arcgisruntime.security.Credential
-
- Direct Known Subclasses:
CertificateCredential,OAuthTokenCredential,UserCredential
public abstract class Credential extends Object
Defines the concept of a Credential, allowing various different types of authenticating credentials to be passed to network requests.- Since:
- 100.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCredential.CredentialChangedEventAn event which indicates that one or more properties of this Credential have changed.static interfaceCredential.CredentialChangedListenerThe listener interface to get notified when one or more properties of a Credential have changed.
-
Constructor Summary
Constructors Constructor Description Credential()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddCredentialChangedListener(Credential.CredentialChangedListener listener)Adds a CredentialChangedListener to this Credential.abstract Credentialcopy()Creates a deep copy of this Credential instance.static CredentialfromJson(String json)Parses the specified json String into a Credential object.StringgetUsername()Gets the username of the credential.booleanremoveCredentialChangedListener(Credential.CredentialChangedListener listener)Removes a CredentialChangedListener from this Credential.StringtoJson()Writes this Credential object to a json String representation.
-
-
-
Method Detail
-
getUsername
public String getUsername()
Gets the username of the credential.- Returns:
- the username
- Since:
- 100.0.0
-
toJson
public String toJson()
Writes this Credential object to a json String representation. This allows for persisting the credential to disk. It is imperative that this String is encrypted before being persisted to disk, or else it may pose a security vulnerability.- Returns:
- a json String representation of this Credential
- Since:
- 100.0.0
-
fromJson
public static Credential fromJson(String json)
Parses the specified json String into a Credential object. This allows for restoring a previously persisted Credential.- Parameters:
json- a json String representation of a Credential- Returns:
- the Credential object parsed from the string or null if the string does not contain Credential json
- Throws:
IllegalArgumentException- if json string is null or empty- Since:
- 100.0.0
-
copy
public abstract Credential copy()
Creates a deep copy of this Credential instance.- Returns:
- a deep copy of this Credential instance
- Since:
- 100.1.0
-
addCredentialChangedListener
public void addCredentialChangedListener(Credential.CredentialChangedListener listener)
Adds a CredentialChangedListener to this Credential.- Parameters:
listener- a CredentialChangedListener- Throws:
IllegalArgumentException- if listener is null- Since:
- 100.8.0
-
removeCredentialChangedListener
public boolean removeCredentialChangedListener(Credential.CredentialChangedListener listener)
Removes a CredentialChangedListener from this Credential.- Parameters:
listener- a CredentialChangedListener- Returns:
- true if the CredentialChangedListener has been removed, otherwise false
- Throws:
IllegalArgumentException- if listener is null- Since:
- 100.8.0
-
-