<p>I am working on a site where users can login to get more private information.
 My client has another site else where that uses <em>nt authentication</em> for accessing it.</p>

<p>What they want to do is have a <code>button</code> on the site I am working on under the private area that will send them to the <em>nt authenticated</em> site, but not require them to log on to that site instead passing the <em>username</em> and <em>password</em> that they used to log into my site to the other site for them.</p>

<p>Is it possible to do this? and how would I accomplish it? Is there a better way to do this?</p>

[{'answer_id': 44162, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 0, 'selected': False, 'text': "<p>How will the other site validate your username and password?</p>\n\n<p>Ideally your site shouldn't even be remembering the user's password to be able to pass it to another site (you store hashes of the password, not the password itself, and only use the actually password during validation).</p>\n\n<p>What if your site provided a token to the user, who presents that token to the new site, which in turn asks your site to validate the token.  Basically the second site is trusting you to tell them who the user is.</p>\n\n<p>This all breaks down if the second site is actually using the Windows accounts for anything other than just retrieving a user name (for example permissions on the underlying file), since the user is not logged on as the actual Windows user account in this scenario.</p>\n"}, {'answer_id': 44765, 'author': 'Jay Mooney', 'author_id': 733, 'author_profile': 'https://Stackoverflow.com/users/733', 'pm_score': 0, 'selected': False, 'text': "<p>If you need to authenticate against the second site, you may need to spawn a new thread and call the windows LogonUser API.  Once you have the security token, assign it to the new thread and do your connection via that thread.</p>\n\n<p>LogonUser requires enhanced privileges, and isn't Managed code, so there are some pretty severe hiccups to using it.  But that's been the only work around I've been able to find to get a Forms authenticated site talking to a Windows Authenticated Service/Site.</p>\n\n<p>Hope this helps.</p>\n"}, {'answer_id': 44809, 'author': 'jason saldo', 'author_id': 1293, 'author_profile': 'https://Stackoverflow.com/users/1293', 'pm_score': 0, 'selected': False, 'text': '<p>Is this an intranet environment?  If so they shouldn\'t have to login anyways.  If sharepoint is setup using "Integrated Authentication" and the site is listed as a trusted site in IE, the browser will use there network cred for auto login.  This can be setup on <a href="http://www.cauldwell.net/patrick/blog/CommentView,guid,c7f1e799-c4ae-4758-9de7-5c3e7a16f3da.aspx" rel="nofollow noreferrer">firefox</a> as well.</p>\n'}, {'answer_id': 44825, 'author': 'Mark Brackett', 'author_id': 2199, 'author_profile': 'https://Stackoverflow.com/users/2199', 'pm_score': 2, 'selected': True, 'text': '<p>Here\'s an (untested) theory, the details of which will greatly depend on what types of authentication the Sharepoint site will accept. I\'ll tackle <a href="http://en.wikipedia.org/wiki/Basic_access_authentication" rel="nofollow noreferrer">Basic</a>, since it\'s the easiest.</p>\n\n<p>You\'ll write out some JavaScript that uses XMLHttpRequest to submit a request to the Sharepoint site, and add their username and password to the request headers. Their browser will run that JavaScript, and get logged into the Sharepoint site.</p>\n\n<p>Now, when they click the link, the client\'s browser should have the cached credentials to send to the Sharepoint site.</p>\n\n<p>Possible issues:</p>\n\n<ul>\n<li>XMLHttpRequest does not allow cross domain auth</li>\n<li>Browser and XHR don\'t share auth info</li>\n<li>Sharepoint and XHR can\'t agree on auth method</li>\n</ul>\n\n<p>Another option is to proxy the connection to Sharepoint, which allows you to login server side (bypassing XHR limitations and browser security) - but requiring load on your server and possibly some URL target issues.</p>\n'}, {'answer_id': 44836, 'author': 'Duncan Smart', 'author_id': 1278, 'author_profile': 'https://Stackoverflow.com/users/1278', 'pm_score': 0, 'selected': False, 'text': "<p>Your users will not be able to connect to the NTLM site directly without getting an NTLM challenge. I would  write what would effectively be a proxy to the NTLM site; i.e your server-side code will have credentials to connect to the NTLM site, and it passes through the requests from your users. </p>\n\n<p>As you mention it's SharePoint (<em>spit</em>) bear in mind that SharePoint has a bunch of Web Services you could use for this (rather than doing screen-scraping).</p>\n"}]
['https://Stackoverflow.com/questions/44102', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2496/']