<p>I am looking for a best practice for End to End Authentication for internal Web Applications to the Database layer.</p>

<p>The most common scenario I have seen is to use a single SQL account with the permissions set to what is required by the application.  This account is used by all application calls.  Then when people require access over the database via query tools or such a separate Group is created with the query access and people are given access to that group.</p>

<p>The other scenario I have seen is to use complete Windows Authentication End to End.  So the users themselves are added to groups which have all the permissions set so the user is able to update and change outside the parameters of the application.  This normally involves securing people down to the appropriate stored procedures so they aren't updating the tables directly.  </p>

<p>The first scenario seems relatively easily to maintain but raises concerns if there is a security hole in the application then the whole database is compromised.</p>

<p>The second scenario seems more secure but has the opposite concern of having to much business logic in stored procedures on the database.  This seems to limit the use of the some really cool technologies like Nhibernate and LINQ.  However in this day and age where people can use data in so many different ways we don't foresee e.g. mash-ups etc is this the best approach.</p>

[{'answer_id': 79030, 'author': 'Stephen Wrighton', 'author_id': 7516, 'author_profile': 'https://Stackoverflow.com/users/7516', 'pm_score': 1, 'selected': False, 'text': "<p>Personally, I don't want normal end users in the database. For an intranet application (especially one which resides on a Domain) I would provide a single account for application access to the database which only has those rights which are needed for the application to function.</p>\n\n<p>Access to the application would then be controlled via the user's domain account (turn off anonymous access in IIS, etc.).</p>\n\n<p><strong>IF</strong> a user needs, and can justify, direct access to the database, then their <strong>domain account</strong> would be given access to the database, and they can log into the DBMS using the appropriate tools.</p>\n"}, {'answer_id': 79065, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>I've been responsible for developing several internal web applications over the past year.</p>\n\n<p>Our solution was using Windows Authentication (Active Directory or LDAP).</p>\n\n<p>Our purpose was merely to allow a simple login using an existing company ID/password. We also wanted to make sure that the existing department would still be responsible for verifying and managing access permissions.</p>\n\n<p>While I can't answer the argument concerning Nhibernate or LINQ, unless you have a specific killer feature these things can implement, Active Directory or LDAP are simple enough to implement and maintain that it's worth trying.</p>\n"}, {'answer_id': 79156, 'author': 'Dale Wright', 'author_id': 11523, 'author_profile': 'https://Stackoverflow.com/users/11523', 'pm_score': 0, 'selected': False, 'text': "<p>Stephen  - Keeping normal end users out of the database is nice but I am wondering if in this day and age with so many experienced computer users coming out of University / College if this the right path.  If someone wants to automate part of their job which includes a VBA update to a database which I allow them to do via the normal application are we losing gains by restricting their access in this way.</p>\n\n<p>I guess the other path implied here is you could open up the Application via services and then secure those services via groups and still keep the users separated from the database.</p>\n\n<p>Then via delegation you can allow departments to control access to their own accounts via the groups as per Jonathan's post.</p>\n"}, {'answer_id': 79204, 'author': 'Dave Neeley', 'author_id': 9660, 'author_profile': 'https://Stackoverflow.com/users/9660', 'pm_score': 0, 'selected': False, 'text': '<p>I agree with Stephen Wrighton. Domain security is the way to go. If you would like to use mashups and what-not, you can expose parts of the database via a machine-readable RESTful interface. <a href="http://subsonicproject.com" rel="nofollow noreferrer">SubSonic</a> has one <a href="http://subsonicproject.com/tips-and-tricks/webcast-using-subsonic-s-rest-handler/" rel="nofollow noreferrer">built in</a>.</p>\n'}, {'answer_id': 79208, 'author': 'Stephen Wrighton', 'author_id': 7516, 'author_profile': 'https://Stackoverflow.com/users/7516', 'pm_score': 3, 'selected': True, 'text': "<p>Dale - That's it exactly. If you want to provide access to the underlying data store to those users then do it via services. And in my experience, it is those experienced computer users coming out of Uni/College that damage things the most. As the saying goes, they know just enough to be dangerous.</p>\n\n<p>If they want to automate part of their job, and they can display they have the requisite knowledge, then go ahead, grant their <strong>domain account</strong> access to the backend. That way anything they do via their little VBA automation is tied to their account and you know exactly who to go look at when the data gets hosed.  </p>\n\n<p>My basic point is that the database is the proverbial holy grail of the application. You want as few fingers in that particular pie as possible. </p>\n\n<p>As a consultant, whenever I hear that someone has allowed normal users into the database, my eyes light up because I know it's going to end up being a big paycheck for me when I get called to fix it.</p>\n"}]
['https://Stackoverflow.com/questions/78984', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11523/']