I am using SharePoint 2013 with AD authentication. Since the front end application is made in Java I am using .net Web APIs to connect to the SharePoint server. So any request from the user browser(Intranet) will call the Java Code that will call the URL exposed from the .net web APIs to connect to the SharePoint server. The front end application will also be AD authenticated.
The front end application will be deployed on different tomcat server (Say server 1) and the SharePoint will be on a different IIS server (Say Server 2) and I can also deploy the .net Web APIs on Server 2 in the same IIS as SharePoint if it is required.
So the issue is coming when I am calling the .net APIs from an application that is hosted outside of Server 2. I have made an dummy .net Web application and hosted it on the server 2 and then everything was working. So if the SharePoint, Front End Application and the APIs are on the same server the structure is working as expected but the moment I take the front end application out of the server 2 (which is the requirement), the SharePoint server responds with Unauthorised error(401).
ClientContext clientContext = new ClientContext(siteUrl);
clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;
As per my understanding so far the code above is able to Authenticate the current user when the Front End Appliation is inside the same server otherwise not.
So how can I pass the authentication from Front End Application that will pass some cookie or token to web api that I can use pass further in clientContext. And also I can not UserName and Password to authenticate the clientContext in any condition
Thanks in advance.