Using Integrated Windows Authentication with SqlRoleProvider in a Silverlight Application

I am working on a web application that requires users to be placed in roles and to receive different permissions based on their roles. This can be easily done using forms authentication and SqlRoleProvider. But the application will be used inside the corporate intranet, and forms authentication forces users to manually register each time they want to use the application. Using Windows Integrated Authentication looks a lot more elegant since users are already logged into the corporate domain. But there is a problem with roles, built-in authentication by default uses roles that are built into Windows user accounts (group membership, etc.). My application requires me to put users in user roles. As for the role associated with database management, this is a much more cost-effective solution. Is there a way to use integrated Windows authentication (for authentication) along with SqlRoleProvider (for roles and user management)?

+4
source share
2 answers

BenCr is right. But I wanted to avoid creating my own role provider and would like to be able to add users with ease (through the built-in ASP.NET configuration tool for Visual Studio)

So, I found this on the net and it works. It turned out to be a lot easier than I thought. You simply include the roles in the web configuration file with Windows Integrated Authentication. Copy the local mdf file (and attach it to the sql server) and it works.

http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx

+3
source

We did just that in our application, you need to create your own RoleProvider, and then specify it in your web.config. Then you can download your roles from any source that you like.

<roleManager enabled="true" defaultProvider="MyRoleProvider"> <providers> <clear /> <add name="MyRoleProvider" type="MyCompany.MyRoleProvider, MyAssembly" /> </providers> </roleManager> 

RoleProvider http://msdn.microsoft.com/en-us/library/system.web.security.roleprovider.aspx

+4
source

Source: https://habr.com/ru/post/1339005/


All Articles