java.lang.Object
com.esri.arcgisruntime.security.Credential
com.esri.arcgisruntime.security.UserCredential
- All Implemented Interfaces:
TokenCredential
Represents a named user credential. User credentials will be used to authenticate
against HTTP-secured services, and to generate tokens for authenticating token-secured
services.
- Since:
- 100.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.esri.arcgisruntime.security.Credential
Credential.CredentialChangedEvent, Credential.CredentialChangedListener
-
Constructor Summary
ConstructorDescriptionUserCredential
(String username, String password) Constructs a UserCredential with the specified username and password.UserCredential
(String username, String password, String referer) Constructs a UserCredential with the specified username, password, and referer. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a deep copy of this UserCredential instance.static UserCredential
createFromToken
(String token, String referer) Creates a UserCredential with the specified token and referer.boolean
Compares this instance with the specified object and indicates if they are equal.Gets the password to use for authenticating with this credential.Gets the referer of this credential, that is the entity that is using the credential to authenticate.int
hashCode()
Returns an integer hash code for this object.void
setPassword
(String password) Sets the password to use for authenticating with this credential.void
setReferer
(String referer) Sets the referer of this credential, that is the entity that is using the credential to authenticate.void
setUsername
(String username) Sets the username of the credential.Methods inherited from class com.esri.arcgisruntime.security.Credential
addCredentialChangedListener, fromJson, getUsername, removeCredentialChangedListener, toJson
-
Constructor Details
-
UserCredential
Constructs a UserCredential with the specified username and password. The username and password will be used for authenticating against services.- Parameters:
username
- the user name of the userpassword
- the password of the user- Throws:
IllegalArgumentException
- if the username or password is null- Since:
- 100.0.0
-
UserCredential
Constructs a UserCredential with the specified username, password, and referer. The username and password will be used for authenticating against services, while the referer indicates the entity on behalf of which authentication is requested.- Parameters:
username
- the user name of the userpassword
- the password of the userreferer
- the referer- Throws:
IllegalArgumentException
- if the username or password is null- Since:
- 100.0.0
-
-
Method Details
-
createFromToken
Creates a UserCredential with the specified token and referer. The token will be used for authenticating against services, while the referer indicates the entity on behalf of which authentication is requested.- Parameters:
token
- the token with which to authenticatereferer
- the referer- Throws:
IllegalArgumentException
- if the token is null or emptyIllegalArgumentException
- if the referer is null or empty- Since:
- 100.1.0
-
setUsername
Sets the username of the credential.- Parameters:
username
- the username to set- Throws:
IllegalArgumentException
- if username is null- Since:
- 100.0.0
-
getPassword
Gets the password to use for authenticating with this credential.- Returns:
- the password
- Since:
- 100.0.0
-
setPassword
Sets the password to use for authenticating with this credential.- Parameters:
password
- the password to set- Throws:
IllegalArgumentException
- if password is null or empty- Since:
- 100.0.0
-
getReferer
Gets the referer of this credential, that is the entity that is using the credential to authenticate.- Returns:
- the referer
- Since:
- 100.0.0
-
setReferer
Sets the referer of this credential, that is the entity that is using the credential to authenticate.- Parameters:
referer
- the referer to set- Since:
- 100.0.0
-
equals
Compares this instance with the specified object and indicates if they are equal. In order to be equal,o
must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null. -
hashCode
public int hashCode()Returns an integer hash code for this object. -
copy
Creates a deep copy of this UserCredential instance.- Specified by:
copy
in classCredential
- Returns:
- a deep copy of this UserCredential instance
- Since:
- 100.1.0
-