开发者

attribute base (role base) security in .net 2010

in asp.net mvc, if u create a simple site, some security code will be inserted automatically and role base security (via attributes) can be applyed to site (u can define roles in web configuration), but i have a windows application and i want to apply this role base autherization and authentication in my application on my开发者_JS百科 methods and ... , i can write my own code to do this (attribute base), but is there any flexible component to do this as asp.net mvc in windows applications? I'm using vs 2010. any suggestion?


In a multi-user Windows application you would typically use Windows based authentication as it is built into Windows (assuming the software runs on a Windows network with a domain controller). Since the user is already logged into a Windows network, why have them log in again?

Setup Active Directory Groups for each Role in your application, and assign Users to those Groups as required. Then use System.DirectoryServices namespace to check whether the current user is a member of a Group/Role in your code. Then you can conditionally enable/disable features based on the user's Role.

For a code example, see: How to write LDAP query to test if user is member of a group?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜