Class SalesforceApi


  • public class SalesforceApi
    extends DefaultApi20
    This class is an implementation of the Salesforce OAuth2 API. The default implementation connects to the Salesforce production environment. If you want to connect to a Sandbox environment you've to use sandbox() method to get sandbox instance of this API
    • Field Detail

      • accessTokenUrl

        private final java.lang.String accessTokenUrl
      • authorizationBaseUrl

        private final java.lang.String authorizationBaseUrl
    • Constructor Detail

      • SalesforceApi

        protected SalesforceApi​(java.lang.String hostName)
        Parameters:
        hostName - The hostname to be used, which is either PRODUCTION_HOST or SANDBOX_HOST.
    • Method Detail

      • getAccessTokenVerb

        public Verb getAccessTokenVerb()
        Description copied from class: DefaultApi20
        Returns the verb for the access token endpoint (defaults to POST)
        Overrides:
        getAccessTokenVerb in class DefaultApi20
        Returns:
        access token endpoint verb
      • getAccessTokenEndpoint

        public java.lang.String getAccessTokenEndpoint()
        Description copied from class: DefaultApi20
        Returns the URL that receives the access token requests.
        Specified by:
        getAccessTokenEndpoint in class DefaultApi20
        Returns:
        access token URL
      • isTLSv11orUpperEnabled

        private static boolean isTLSv11orUpperEnabled​(javax.net.ssl.SSLSocket socket)
      • initTLSv11orUpper

        public static void initTLSv11orUpper()
                                      throws java.security.NoSuchAlgorithmException,
                                             java.security.KeyManagementException,
                                             java.io.IOException
        Salesforce API requires to use TLSv1.1 or upper.

        Java 8 have TLS 1.2 enabled by default. java 7 - no, you should invoke this method or turn TLS>=1.1 somehow else

        Throws:
        java.security.NoSuchAlgorithmException - in case your jvm doesn't support TLSv1.1 or higher
        java.security.KeyManagementException - unexpected Exception from SSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)
        java.io.IOException - unexpected Exception from SocketFactory.createSocket()