function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Danny5Danny5 

Best Practice for Soap API client and salesforce logon credentials

Hoping someone well versed in salesforce security best practices can point me in the right direction.

I searched the previous posts in this forum and did not find quite the right thing.

 

I have a small java PC application that uses the Soap API to send various data to salesforce.

 

Currently I am storing the salesforce logon credentials in a local database used by the application.

The username / password to connect to this database is encrypted and never accessed in clear text in the code.

(Although, since the application is stand alone, everything needed to decrypt the database credentials is packaged with the application. It would not be easy to get the clear text credentials, but possible)

 

I was looking for different alternates to having to store the salesforce credentials in my applications database. 

The caveat in my case is that the user of my application is not even aware (nor should be) that the application is interacting with saleforce at all.  All the end user knows is that an entity (that they already have a relationship with) has asked them install this application in order to provide the entity (the owner of the salesforce org) with certain data from the user.

 

Is there a better way to do this that I haven't run across yet?  The other login alternatives I have seen OAuth, SAML seem to require additional steps by the user who installs my application that they would not be aware of.

 

Any help is much appreciated.

 

Thank you

BrendanOCBrendanOC

Does each user have their own user account in Salesforce, or are you running all instances of the client under a shared account?

 

Does the user know their password for Salesforce (even if they don't know that they are using Salesforce?)

 

I can think of a couple of ways to solve this:

 

1) store each user's username in a configuration file, and prompt the user for their password when the application first starts (even if they don't know the password goes to Salesforce.com)  Then do an API call to log the user in and read the Session ID in the API response.

 

2) If the client network has a SAML provider, you can probably do a behind-the-scenes SAML login.  This is dependent upon the network, but if the user is already authenticated to their local workstation, you may be able to perform SAML based on their local credentials. (for example, a call to an internal web server that is configured for Windows Integrated Authentication)

 

3) Use a combination of Apex Web Services and Public Sites.  This would be an UNAUTHENTICATED transaction, so make sure you are very careful.  You could potentially use IP range restrictions to lock down access to the public site, but this is still not a very secure approach.

 

If you can add more detail to your specific use case, I may have some better ideas.

 

Hope that helps!

 

Brendan

Danny5Danny5

Thank you for the response.

 

- All instances of the client use the same salesforce logon/account.

 

- The user does not know the password (or username) for salesforce.  The application does contain a way for the user to set a new token.  This would only ever need to be used is the case of the existing token (or password) being reset in the salesforce ui.

 

A use case:

The client application sends documents (say a pdf) and attachs it to an Account object in salesforce.  This occurs in an automated fashion (like a windows scheduled task)  So at certain times the application wakes up, looks for a document on the local PC, if found, sends that document to salesforce.

The client user is only aware that the application sends data to the business that asked them to install the application (which they have an existing relationship with) So in a perfect world (from the client users perspective, all of this just happens, without the client user having to know any username, password or token to salesforce. 

 

Currently they are stored in a local database, the credentials to connect to this database are in encrypted form on the PC, but being a self contained application the keys need to decrypt the database credentials are embedded in the application deliverable.  Not as secure as I would like, but I don't see another way without the user having to know the salesforce credentials

 

Thanks for any advise.