0

I'm building a custom application on Sharepoint 2010 that runs in an IIS virtual directory under a Sharepoint site (so it has access to SPContext and such which I need). My application (Asp.net MVC by the way) is using its own SQL Server database.

Everything works as expected (application has been in development for a year now) and it came to a point when it needs to be deployed.

I've configured my SQL connection to use a single SQL DB user to access my database. But I would like to use Integrated Security = SSPI or in other words I'd like my application to access my custom DB using the Sharepoint logged on user.

I suppose I should first impersonate my user to run Sharepoint site and after that use SQL connection setting for integrated security. But I suppose that turning on impersonation in Sharepoint 2010 isn't just a switch in web.config is it?

Additional info

I'm not using any of the Sharepoint database connectivity functionality to access my database. I just use my own connection string and access my database manually. In other words I'm not using Sharepoint BCS or anything else.

1
  • Hi Robert, welcome to our community. Please use the "flag" option if you think a post need moderators attention, then we get a notice that you need help :-) May 4, 2011 at 6:46

1 Answer 1

1

Is your SQL server running on the same server? If not you will run into the double-hop authentication issue and you will need to configure Kerberos. If SQL is on the same box and you have SharePoint configured for Windows Integrated authentication then integrated security should just work - no special configuration required.

6
  • @Chris Beckett: Same server as: (1) my DB on the same DB server as sharepoint DB or (2) my DB on the same physical server as web server? Answer: In development the second one is met in production the first one will be. All databases will be on the same DB server but machine is not the same as the web server. May 4, 2011 at 6:19
  • @Chris Beckett: Check my additional question info as well, because it's probably important as well. May 4, 2011 at 6:22
  • a) SharePoint is built on ASP.NET, and so are your customizations. You don't have to use something like BCS to access a SQL database from your custom code. b) If you are deploying your customizations under SharePoint and have access to the SPContext, then you are running in the SharePoint and will inherit the users security context for impersonation, c) if SQL server is running on a remote server you will have to deal with double-hop authentication. To pass-thru the user's security identity to SQL you will either need to configure Kerberos, or use Secure Store Service for Single-Signon. May 4, 2011 at 17:09
  • @Chris Beckett: That's valuable info. Why don't you put it in your answer along with some links where I could get additional info how to set up such stuff. The thing is I've been a developer for a very long time but have never done such a thing. I could of course search the web for it but maybe you know of valuable resources so I don't have to look them up myself. May 4, 2011 at 18:23
  • 1
    Google search on "SharePoint 2010 Kerberos" brings up everything you need, but here is the link to an MSDN white paper you can download. There is also a whitepaper on TechNet: microsoft.com/downloads/en/… May 5, 2011 at 2:46

Your Answer

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

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