1

I'm investigating ways to integrate an existing SQL Server database into my firm's Sharepoint installation. I've put together some external content types, but I'd also like to develop an application page to replace our existing frontend. Before I can even get started, though, I need to figure out how to get authentication working.

Our database currently uses Windows authentication, and I'm hoping to keep it that way, but we're currently using NTLM, not Kerberos, so I can't use AD to log users into the database. I can use the secure store to store credentials for external content types. Is there a way to leverage those credentials for use in my application page as well?

I understand how to get credentials out of the secure store for SQL Server authentication, but I haven't been able to find any information on doing the same with Windows authentication. Can I somehow piggyback on the connection being used by the external content types? Or maybe I could use the windows user name and password to impersonate a windows login to SQL Server? Or possibly the answer is something else altogether.

Any suggestions would be appreciated. Thanks for your help!

1 Answer 1

1

I faced a similar problem very recently, and my solution was as follows:

  • Retrieve the credentials from the Secure Store, as described on MSDN.
  • Use this codeproject page as a guide to build an Impersonate User class.
  • Surround the calls made to the database with Impersonation of the user from the Secure Store.

I then created a base class for my BDC Service classes that covered these three things (and a selection of other utility methods) to avoid code duplication.

2
  • It works! I tested the Impersonate User class by hardcoding my username and password, and it worked great. The rest is just details; I'll get to work on actually getting the credentials now that I know it works. Thanks for your help! Aug 7, 2012 at 14:23
  • @JeffRosenberg glad to save you some time figuring it out, this was a real PITA for me to get going. :)
    – TZHX
    Aug 7, 2012 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.