com.esri.core.io
Class UserCredentials

java.lang.Object
  extended by com.esri.core.io.UserCredentials
All Implemented Interfaces:
Serializable

public class UserCredentials
extends Object
implements Serializable

This class represents user credential for accessing secure ArcGIS Services and Tasks. A user's credential is either composed of a user account (username,password) or a secure token.

See Also:
Serialized Form

Nested Class Summary
static class UserCredentials.AuthenticationType
          The supported authentication type.
 
Constructor Summary
UserCredentials()
          Constructs an instance of UserCredentials.
UserCredentials(UserCredentials other)
          Instantiates a copy of the given credential.
 
Method Summary
 boolean equals(Object obj)
           
 UserCredentials.AuthenticationType getAuthenticationType()
          Gets the type of the UserCredentials.
 UserCredentials getCopy()
          Returns a copy of the instance.
 String getPassword()
          Returns the password that this instance was initialized with
 String getReferer()
          Returns the referer that was supplied with the token string.
 String getToken()
          Returns the token that this instance was initialized with.
 String getTokenServiceUrl()
          Returns the remote token service url that this instance was initialized with
static KeyStore getTrustStore()
          Returns the KeyStore that contains trusted self-signed certificates for accesing HTTPS GIS service and Task service endpoints in an application.
 String getUserName()
          Returns the user name that this instance was initialized with
 int hashCode()
           
 boolean isSSLRequired()
          Returns whether or not the service should only be connected to with SSL encryption (usually https).
 void setAuthenticationType(UserCredentials.AuthenticationType type)
          Sets the type of the UserCredentials.
 void setSSLRequired(boolean required)
          Sets whether or not the service should only be connected to with SSL encryption (usually https).
 void setTokenServiceUrl(String tokenServiceUrl)
          Sets the URL to a remote token service if it is different from the default ArcGIS token service.
static void setTrustStore(KeyStore keyStore)
          Sets a KeyStore that contains trusted self-signed certificates for accesing HTTPS GIS service and Task service endpoints in an application.
 void setUserAccount(String userName, String password)
          Sets the user account for accessing a secure Service or Task in an application.
 void setUserToken(String token, String referer)
          Sets the user token for accessing a secure Service or Task in an application.
 UserCredentials.AuthenticationType verifyAuthenticationType()
          Looks up the authentication type based on the information available.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserCredentials

public UserCredentials()
Constructs an instance of UserCredentials.


UserCredentials

public UserCredentials(UserCredentials other)
Instantiates a copy of the given credential.

Parameters:
other - the instance to copy.
Method Detail

getCopy

public UserCredentials getCopy()
Returns a copy of the instance.

Returns:
a copy.

setTrustStore

public static void setTrustStore(KeyStore keyStore)
                          throws EsriSecurityException
Sets a KeyStore that contains trusted self-signed certificates for accesing HTTPS GIS service and Task service endpoints in an application.

Parameters:
keyStore - the KeyStore.
Throws:
EsriSecurityException

getTrustStore

public static KeyStore getTrustStore()
Returns the KeyStore that contains trusted self-signed certificates for accesing HTTPS GIS service and Task service endpoints in an application.

Returns:
the KeyStore

setUserAccount

public void setUserAccount(String userName,
                           String password)
Sets the user account for accessing a secure Service or Task in an application.

Parameters:
userName - the username
password - the password

setUserToken

public void setUserToken(String token,
                         String referer)
Sets the user token for accessing a secure Service or Task in an application. The token is a secure token generated by an ArcGIS Token service or a Remote token service. Tokens are generated either by sending an HTTP URL request to a Token service end-point or through an HTML page. Regardless of which option is chosen, it is always necessary for a clientid paramter to be specified as a parameter for generating a secure token. The clientid is typically the identity of the client application consuming the secure service. For Android/Java applications, the clientid would be the referer string that is either the name of the application consuming the secure service or any other client identification string that is appropriate for the application. It is required that the referer string that was used to generate the token be supplied to this method. For documentation on how to generate tokens please refer to the following resource Tokens and token services

Parameters:
token - the secure token string
referer - the referer string

setTokenServiceUrl

public void setTokenServiceUrl(String tokenServiceUrl)
Sets the URL to a remote token service if it is different from the default ArcGIS token service. If the application invoking this API is an Android application which along with the token service is part of the same LAN, then the hostname in the URL must be fully qualified to avoid DNS name resolution problems in Android.

Parameters:
tokenServiceUrl - a URL to a remote token service

getToken

public String getToken()
Returns the token that this instance was initialized with.

Returns:
the token

getReferer

public String getReferer()
Returns the referer that was supplied with the token string.


getTokenServiceUrl

public String getTokenServiceUrl()
Returns the remote token service url that this instance was initialized with

Returns:
the remote token service url

getUserName

public String getUserName()
Returns the user name that this instance was initialized with

Returns:
the user name

getPassword

public String getPassword()
Returns the password that this instance was initialized with

Returns:
the password

isSSLRequired

public boolean isSSLRequired()
Returns whether or not the service should only be connected to with SSL encryption (usually https).

Returns:
Returns returns true if using SSL.

setSSLRequired

public void setSSLRequired(boolean required)
Sets whether or not the service should only be connected to with SSL encryption (usually https).

Parameters:
required - set to ture to use SSL.

getAuthenticationType

public UserCredentials.AuthenticationType getAuthenticationType()
Gets the type of the UserCredentials.

Returns:
Returns the _type.
See Also:
verifyAuthenticationType()

setAuthenticationType

public void setAuthenticationType(UserCredentials.AuthenticationType type)
Sets the type of the UserCredentials.

Parameters:
type - The type to set.

verifyAuthenticationType

public UserCredentials.AuthenticationType verifyAuthenticationType()
Looks up the authentication type based on the information available. If the credentials contains either the token or the token service URL, the Credentials will be treated as Token based credentials, otherwise it is a http based credentials if the Username and password are available. The AuthenticationType.None will be set if none information is available;


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.