简体   繁体   English

如何使用自定义令牌对WCF服务进行全局身份验证

[英]how to Authenticate WCF service globally using custom token

I wanted to add a global Custom token authentication on each service call in wcf rest service. 我想在wcf rest服务的每个服务调用上添加全局自定义令牌身份验证。 My service having more than 50 (Get/Post) methods. 我的服务有50多种(获取/发布)方法。 Now I am passing token in each method and authenticate them, Now i wanted to do that globally using something like global.asax or routing or attribute reading 现在我在每种方法中传递令牌并对它们进行身份验证,现在我想使用诸如global.asax或路由或属性读取之类的方法在全局范围内进行操作

Thank you 谢谢

For getting the dynamic solution i went through multiple links to understand WCF parameter validation and I found the solution here 为了获得动态解决方案,我通过多个链接来了解WCF参数验证,并在这里找到了解决方案

Create a class that inherate IparameterInspector 创建一个继承IparameterInspector的类

IparameterInspector usesbase class as IoperationBehaviour IparameterInspector使用基类作为IoperationBehaviour

Add the created class to your operation contract as a Attribute 将创建的类作为属性添加到您的操作合同中

For detail descrption see the link WCF Extensibility using IParameterInspector 有关详细说明,请参见使用IParameterInspector的链接WCF可扩展性

If you want you can Comment you query or question to get my actual code for Get and Post method 如果您希望可以发表评论,请查询或提问以获取我的Get和Post方法的实际代码

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

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