Package com.esri.arcgisruntime.security
Class UserCredential
- java.lang.Object
-
- com.esri.arcgisruntime.security.Credential
-
- com.esri.arcgisruntime.security.UserCredential
-
- All Implemented Interfaces:
TokenCredential
public final class UserCredential extends Credential implements 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
Constructors Constructor Description UserCredential(java.lang.String username, java.lang.String password)
Constructs a UserCredential with the specified username and password.UserCredential(java.lang.String username, java.lang.String password, java.lang.String referer)
Constructs a UserCredential with the specified username, password, and referer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UserCredential
copy()
Creates a deep copy of this UserCredential instance.static UserCredential
createFromToken(java.lang.String token, java.lang.String referer)
Creates a UserCredential with the specified token and referer.boolean
equals(java.lang.Object o)
Compares this instance with the specified object and indicates if they are equal.java.lang.String
getPassword()
Gets the password to use for authenticating with this credential.java.lang.String
getReferer()
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(java.lang.String password)
Sets the password to use for authenticating with this credential.void
setReferer(java.lang.String referer)
Sets the referer of this credential, that is the entity that is using the credential to authenticate.void
setUsername(java.lang.String username)
Sets the username of the credential.-
Methods inherited from class com.esri.arcgisruntime.security.Credential
addCredentialChangedListener, fromJson, getUsername, removeCredentialChangedListener, toJson
-
-
-
-
Constructor Detail
-
UserCredential
public UserCredential(java.lang.String username, java.lang.String password)
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:
java.lang.IllegalArgumentException
- if the username or password is null or empty- Since:
- 100.0.0
-
UserCredential
public UserCredential(java.lang.String username, java.lang.String password, java.lang.String referer)
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:
java.lang.IllegalArgumentException
- if the username or password is null or empty- Since:
- 100.0.0
-
-
Method Detail
-
createFromToken
public static UserCredential createFromToken(java.lang.String token, java.lang.String referer)
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:
java.lang.IllegalArgumentException
- if the token is null or emptyjava.lang.IllegalArgumentException
- if the referer is null or empty- Since:
- 100.1.0
-
setUsername
public void setUsername(java.lang.String username)
Sets the username of the credential.- Parameters:
username
- the username to set- Throws:
java.lang.IllegalArgumentException
- if username is null or empty- Since:
- 100.0.0
-
getPassword
public java.lang.String getPassword()
Gets the password to use for authenticating with this credential.- Returns:
- the password
- Since:
- 100.0.0
-
setPassword
public void setPassword(java.lang.String password)
Sets the password to use for authenticating with this credential.- Parameters:
password
- the password to set- Throws:
java.lang.IllegalArgumentException
- if password is null or empty- Since:
- 100.0.0
-
getReferer
public java.lang.String 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
public void setReferer(java.lang.String referer)
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
public boolean equals(java.lang.Object o)
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.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the object to compare this instance with.- Returns:
true
if the specified object is equal to thisObject
;false
otherwise.- See Also:
hashCode()
-
hashCode
public int hashCode()
Returns an integer hash code for this object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- this object's hash code.
- See Also:
equals(java.lang.Object)
-
copy
public UserCredential 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
-
-