Four Stars

Salesforce Mutual Authentication Example(s)

Does anyone have any examples of how to setup Mutual Authentication on Salesforce and Talend?

It's basically a follow-up question from this old post:

https://www.talendforge.org/forum/viewtopic.php?id=38409

 

I need to establish a secure connection between the Talend job and Salesforce, and these are the components I'm using:

- tSalesforceConnection

- tSetKeystore

- tJava

- tSalesforceInput

 

I can establish a connection to Salesforce without any problems, and the tSetKeystore component seems to set correctly the Mutual Authentication certificate (because I don't get any errors in that part of execution, and I check for the existence of both Truststore ".crt" file and Keystore ".jks" file).  I've also implemented a tJava component to change the URL of the tSalesforceConnection to use port 8443 after the initial connection has been established.  It's only when the process gets to the tSalesforceInput that the job fails with the following error:

 

 

<exceptionCode>InvalidSessionId</exceptionCode>
<exceptionMessage>This session could not be mutually authenticated for use with the API</exceptionMessage>

 

 

The entire job is outlined here:

 

Mutual Authentication Talend JobMutual Authentication Talend Job

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The code that is worth mentioning is the "change port" component:

 

org.talend.components.salesforce.SalesforceConnectionProperties props_tSalesforceConnection_1 =
(org.talend.components.salesforce.SalesforceConnectionProperties) globalMap.get("tSalesforceConnection_1_COMPONENT_RUNTIME_PROPERTIES"); props_tSalesforceConnection_1.setValue("endpoint", context.endpoint_8443); globalMap.put("tSalesforceConnection_1_COMPONENT_RUNTIME_PROPERTIES", props_tSalesforceConnection_1);

where "context.endpoint_8443" is a reference to:

https://test.salesforce.com:8443/services/Soap/u/39.0

 

 

 

Any ideas how to fix this?  Greatly appreciated.

 

Thanks.

5 REPLIES
Seven Stars

Re: Salesforce Mutual Authentication Example(s)

Hi,

 

Can you please provide the screenshot of tSalesforceInput property? in this are you using the existing connection or modified values in your tJava component?

 

 

 

 

 

Thanks,
Sid
Mark as solution if this resolved your issue
Four Stars

Re: Salesforce Mutual Authentication Example(s)

Hi Sid.

 

Here's the tSalesforceInput component:

 

tSalesforceInput_example.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Notice that the tJava component is the third in the execution list.  That's where the example source code sits from the example I originally posted.  The screenshot here is for the tSalesforceInput parameters.  To answer your question: both....

I am using the existing connection called "con_bulk" but as far as I know, I modified the endpoint after the initial login to use port 8443.  So this component should be using the modified port information set in the tJava component.  It may be that the line:

 

props_tSalesforceConnection_1.setValue("endpoint", context.endpoint_8443);

Did not do its' job correctly?

 

Thanks for checking.

Twelve Stars TRF
Twelve Stars

Re: Salesforce Mutual Authentication Example(s)

Not sure you're able to change the endpoint after the connection has been established.

TRF
Four Stars

Re: Salesforce Mutual Authentication Example(s)

How come it was done as documented here?

https://www.talendforge.org/forum/viewtopic.php?id=38409

 

That's why I'm going initially with this approach.  Do you mean that I first should run the tJava to modify the endpoint URL, and then connect to SF?

That would be the same thing as putting the URL endpoint using the port as :8443 directly in the enpoint string parameter in the "tSalesforceConnection" component, correct?

Twelve Stars TRF
Twelve Stars

Re: Salesforce Mutual Authentication Example(s)

I think so.

TRF