Search code examples
c#restwcfwcf-security

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. My service having more than 50 (Get/Post) methods. 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

Thank you


Solution

  • For getting the dynamic solution i went through multiple links to understand WCF parameter validation and I found the solution here

    Create a class that inherate IparameterInspector

    IparameterInspector usesbase class as IoperationBehaviour

    Add the created class to your operation contract as a Attribute

    For detail descrption see the link WCF Extensibility using IParameterInspector

    If you want you can Comment you query or question to get my actual code for Get and Post method