0
votes

I am creating a custom upload page to Sharepoint but want to streamline the authentication if possible. At the moment I can successfully connecting to Sharepoint using ClientContext and setting the credentials using the following context.Credentials = new SharePointOnlineCredentials(username, securePassword);

However, this means I need a login page to get the username and password to send. They would then also need to login again into the Sharepoint site when they are redirected to the documents page after the upload.

The username and password are the same as their AD login details so ideally I would either use this or have them login to the Sharepoint site directly and store the credentials for use in my page. This would prevent them from having to input it twice.

Does anyone have any ideas on how to achieve this. I've tried CredentialCache.DefaultCredentials and CredentialCache.DefaultNetworkCredentials but am getting a forbidden error/access denied and Before opening files in this location you must first browse to the web site and select the option to login automatically.

2
Is this an Inter or Intra net application? - Joshua Drake
Why is your app planning to store/hold the credentials? - Joshua Drake
The application will sit as a go between Salesforce and Sharepoint. This means the user already has to login to Salesforce and Sharepoint. At least they only have to do this once during the day. However, the last thing I want to do is introduce a third login page when they come to my application. Ideally the web app would check the user is logged into Sharepoint and if they are use these credentials. I only plan to store the token in cookies. - Graham

2 Answers

0
votes

I think the answer to your question is difficult to sum up in post. Allow me to try my best to explain what I think you are looking for.

You can have different authentication models at "Web Application" level. This means that all your site collections inside your Web Application will work with the same authentication model. If you already have a web application working with Active Directory and you want to provide Internet Access (probably using Forms Authentication) you will need to create a separate Web Application.

Here is a sample Video on how to create a new Web Application:

http://www.youtube.com/watch?v=0Z8vb42j1wQ

And this is a video on how to implement Forms Authentication a Web Application:

http://www.youtube.com/watch?v=yBqL3E-ne60

0
votes

I've made a bit of progress and believe the code on the following is on the right path https://code.msdn.microsoft.com/remote-authentication-in-b7b6f43c, however, this opens up a new browser window rather than the current window causing an error when opening the WebBrowser() (not a single threaded apartment).