I have a authentication problem.I have planned to use COmetD libray to subscribe any Sobject Changes to hit my java application.Is there any mechanism to authenticate a Call that comes from salesforce. I could not barely accept the json from salesforce in my java application without any authentication.How to overcome this problem
The network layers take care of this authentication for you. When you subscribe to a CometD connection, you start by calling the Salesforce server, which enters a long polling loop with you. This connection is secured by TLS, which is considered unbreakable (at least, for TLS1.1 and above, which is required to connect to Salesforce at all). At no point does any outside connection attempt to contact your application; the session between you and the server is established by your client and verified by the TLS protocol. There is no practical way that a man-in-the-middle or some other server could inject data that your application would ever see.