Last post Jun 01, 2015 04:07 AM by Akbari123
May 31, 2015 05:18 AM|Akbari123|LINK
I've asked this question
before, but I was misunderstood. So, let's try again! :)
For some reasons, my users should have their database Logins. The only way I can ensure security in this situation is to grant limited permissions for each login. So when I register a new user in the app, the app should actually create a new database login
and grant certain permissions to it.
Users, roles and permissions are all dynamic and administrators should be able to change them.
I'm not sure what do I need to implement this feature. If there is not any out of the box solution, based on your experience how should I implement it?
Thanks in advance,
Jun 01, 2015 02:47 AM|Zhi Lv - MSFT|LINK
Will you please explain more details about the database login, I don't understand what do you mean? From your description, it seems that you want to handle authentication and authorization in your application. If that is the case, I suggest you could try
to use Asp.Net Identity.
You could use UserManager class to manage user, such as add user, add user to role, delete user and so on.
You could also use RoleManager class to manage roles, such as add roles, delete roles and so on.
Here are some tutorials about Identity, please refer to them:
Jun 01, 2015 04:07 AM|Akbari123|LINK
Thanks for your replay, I'm familiar with Identity 2. What I'm looking for is to make it use database logins for authentication.
In default Identity stores all of the users and roles in a table inside the database, right? I don't want users just be a record inside a table, I want them to be real database credentials. Because this is an Intranet app and they need to have their database
credential anyway. But we're looking to make those credentials as limited as possible.
So when a user tries to login, the controller should try to connect to the database with those credentials, if it was succeed, the user is authenticated. The app will not have any credentials on its own.
I'm not sure if I'm clear enough, please ask for further clarification.