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
  • Constructor Details

    • Credential

      public Credential()
  • Method Details

    • 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