Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings!

I'm trying to implement a winform application where the user is required to login. Once the user logs in, he/she will have access to the corresponding database objects, according to his/her SQL user role. The problem is that I'm not sure of a secure way of implementing this ( and google is not too friendly today...)

One method I thought up was to make a base user that only has access to the stored procedure that retrieves the password hash of users attempting to login, and once the user provides the correct password, the connection string is dynamically changed during runtime. But then, really thinking about it, it defeats the whole purpose of storing the password hash in the database. Any ideas?
Posted

1 solution

What are you using to connect to the database? An ORM, a SqlConnection Object, other methods?
Here is an article on Security Guidelines in ADO.NET2.0[^], which I guess should be fine if you're using SqlConnection Objects.
Here is a more up-to-date, but less detailed article[^] on ADO.NET4.
When working with ORM's, such as the Entity Framework, I think you should check the website of that product on best practices for connecting to databases. Here is an article on security considerations in Entity Framework 4.[^]
Sorry that I could not be more detailed, but I think the above links should provide you with enough clues as to how to connect to a database (Windows logon, SQL logon, encrypted password). Which approach works best for you is dependent on your situation, technologies and needs.
Hope it helps! :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900