简体   繁体   English

WCF webservice ASP.Net C# 4.0 的授权属性

[英]Authorization attribute for an WCF webservice ASP.Net C# 4.0

Part of the team has created a WCF web service, and I have to protected it by using Asp.Net Roles.团队的一部分创建了一个 WCF web 服务,我必须使用 Asp.Net 角色来保护它。 I have thought in a number of possibilities, like creating an authorization attribute (similar to the one in the MVC framework) but I feel completely lost.我已经考虑了很多可能性,比如创建一个授权属性(类似于 MVC 框架中的那个),但我觉得完全迷失了。 Anyone any idea where to start?有人知道从哪里开始吗?

Any response is appreciated.任何回应表示赞赏。 Thanks谢谢

I think you should use a Custom Role Provider.我认为您应该使用自定义角色提供程序。 It can be used manually from the code or using PrincipalPermissionAttribute.它可以从代码中手动使用,也可以使用 PrincipalPermissionAttribute。 When WCF service method is decorated with the attribute your Role Provider will be used (it should be defined in web.config file) in order to authorize the user当 WCF 服务方法被属性修饰时,您的角色提供者将被使用(它应该在 web.config 文件中定义)以便授权用户

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM