Package com.github.scribejava.apis
Class SalesforceApi
- java.lang.Object
-
- com.github.scribejava.core.builder.api.DefaultApi20
-
- com.github.scribejava.apis.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 usesandbox()method to get sandbox instance of this API
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSalesforceApi.InstanceHolder
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringACCESS_PATHprivate java.lang.StringaccessTokenUrlprivate java.lang.StringauthorizationBaseUrlprivate static java.lang.StringAUTHORIZE_PATHprivate static java.lang.StringPRODUCTION_HOSTprivate static java.lang.StringPROTOCOLprivate static java.lang.StringSANDBOX_HOST
-
Constructor Summary
Constructors Modifier Constructor Description protectedSalesforceApi(java.lang.String hostName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAccessTokenEndpoint()Returns the URL that receives the access token requests.TokenExtractor<OAuth2AccessToken>getAccessTokenExtractor()Returns the access token extractor.VerbgetAccessTokenVerb()Returns the verb for the access token endpoint (defaults to POST)protected java.lang.StringgetAuthorizationBaseUrl()ClientAuthenticationgetClientAuthentication()static voidinitTLSv11orUpper()Salesforce API requires to use TLSv1.1 or upper.static SalesforceApiinstance()private static booleanisTLSv11orUpperEnabled(javax.net.ssl.SSLSocket socket)static SalesforceApisandbox()-
Methods inherited from class com.github.scribejava.core.builder.api.DefaultApi20
createService, getAuthorizationUrl, getBearerSignature, getDeviceAuthorizationEndpoint, getDeviceAuthorizationExtractor, getRefreshTokenEndpoint, getRevokeTokenEndpoint
-
-
-
-
Field Detail
-
PRODUCTION_HOST
private static final java.lang.String PRODUCTION_HOST
- See Also:
- Constant Field Values
-
SANDBOX_HOST
private static final java.lang.String SANDBOX_HOST
- See Also:
- Constant Field Values
-
PROTOCOL
private static final java.lang.String PROTOCOL
- See Also:
- Constant Field Values
-
ACCESS_PATH
private static final java.lang.String ACCESS_PATH
- See Also:
- Constant Field Values
-
AUTHORIZE_PATH
private static final java.lang.String AUTHORIZE_PATH
- See Also:
- Constant Field Values
-
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 eitherPRODUCTION_HOSTorSANDBOX_HOST.
-
-
Method Detail
-
instance
public static SalesforceApi instance()
-
sandbox
public static SalesforceApi sandbox()
-
getAccessTokenVerb
public Verb getAccessTokenVerb()
Description copied from class:DefaultApi20Returns the verb for the access token endpoint (defaults to POST)- Overrides:
getAccessTokenVerbin classDefaultApi20- Returns:
- access token endpoint verb
-
getAccessTokenEndpoint
public java.lang.String getAccessTokenEndpoint()
Description copied from class:DefaultApi20Returns the URL that receives the access token requests.- Specified by:
getAccessTokenEndpointin classDefaultApi20- Returns:
- access token URL
-
getAuthorizationBaseUrl
protected java.lang.String getAuthorizationBaseUrl()
- Specified by:
getAuthorizationBaseUrlin classDefaultApi20
-
getAccessTokenExtractor
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor()
Description copied from class:DefaultApi20Returns the access token extractor.- Overrides:
getAccessTokenExtractorin classDefaultApi20- Returns:
- access token extractor
-
isTLSv11orUpperEnabled
private static boolean isTLSv11orUpperEnabled(javax.net.ssl.SSLSocket socket)
-
initTLSv11orUpper
public static void initTLSv11orUpper() throws java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOExceptionSalesforce 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 higherjava.security.KeyManagementException- unexpected Exception fromSSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)java.io.IOException- unexpected Exception fromSocketFactory.createSocket()
-
getClientAuthentication
public ClientAuthentication getClientAuthentication()
- Overrides:
getClientAuthenticationin classDefaultApi20
-
-