I have WCF service with 5 operation contracts. Say 200 users using this service. Now new 50 clients want only 3 operations from this WCF service.
How do I restrict them to use only 3 and block other 2 operations ?
I have WCF service with 5 operation contracts. Say 200 users using this service. Now new 50 clients want only 3 operations from this WCF service.
How do I restrict them to use only 3 and block other 2 operations ?
You are probably best off looking at some kind of role based authorization. This can be easily implemented as an attribute on the datacontract. The actual logic to determine as to whether that particular user is authorised is entirely by your design.
Alternatively, you can expose different endpoints that have a different interface defined and use shared methods for code re-use.
public Interface IInterface1
{
void Method1(int something);
void Method2(int something);
}
public Interface IInterface2
{
void Method1(int something);
void Method3(int something);
}
public InterfaceImplementation1 : IInterface1
{
public void Method1(int something)
{
SharedClass.SharedMethod1(something);
}
public void Method2(int something)
{
SharedClass.SharedMethod2(something);
}
}
public InterfaceImplementation2 : IInterface2
{
public void Method1(int something)
{
SharedClass.SharedMethod1(something);
}
public void Method3(int something)
{
SharedClass.SharedMethod3(something);
}
}
public class SharedClass
{
public static void SharedMethod1 (int something)
{
DoSomething(something);
}
public static void SharedMethod2 (int something)
{
DoSomething(something);
}
public static void SharedMethod3 (int something)
{
DoSomething(something);
}
}