开发者

Silverlight app for select windows users

开发者 https://www.devze.com 2023-02-08 12:29 出处:网络
I have a simple silve开发者_运维技巧rlight application hosted on a corporate network. However I want to allow access to this website to few select NT users and restrict the rest. How do I configure it

I have a simple silve开发者_运维技巧rlight application hosted on a corporate network. However I want to allow access to this website to few select NT users and restrict the rest. How do I configure it?

Also would such a configuration work for out of browser as well?


you should enable the Integrated windows authentication in the IIS web site or virtual directory configuration. After that in any moment you can take the User.Identity and User.Principal objects and cast them to WindowsIdentity and WindowsPrincipal and check if current user is in a certain role ( aka in a windows group ) or his/her username...

about out of the box I don't know because I have never tried it but you could surely test it once you have a label showing current user name in your SL User Interface, checking if the functionality is the same in the browser or out of browser. Hope this helps...


There are several things you can do.

1) Restrict access to the web services this is calling into - Davide's answer covers this nicely.

2) Restrict access to thw website where the SL app exists, which is easy to do with ASP.NET and the built-in support for Windows Authentication via a MembershipProvider. This way, a user can't even load the HTML page hosting the Silverlight app if they're not in the right role. This would also prevent them from installing the app as Out of Browser, as they can never get to it in the first place.

3) In the OOB mode of the app (when Application.Current.IsRunningOutOfBrowser is true), at startup call into a web service that verifies the user is in the right role - if they're not, the app could simply diplay a "not authorized" visual and not show the real app functionality.

This way, if the user ever was in the role and installed the app OOB, but then lost that permission, they'd still not be able to use the app.

As to implementation of all this, I suggest looking at WCF RIA Services. It has great authentication/authorization support that should simplify implementing this, even if you don't want to use RIA Services for data access for whatever reason (though I recommend that as well, it helps hide a lot of the async complexity of Silverlight data access).

0

精彩评论

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