I want to decorate certain Operation Contracts with an attribute to authorize the caller by custom logic, something like this:
[ServiceBehavior]
public class Service1
{
[OperationContract]
[Authorize] // ?? this should make sure only admins can call this method
public List<SampleItem> GetCollection()
{
return new List<SampleItem>() { new SampleItem("Only Admins see me") };
}
}
The [Authorize] should check if the caller is entitled to call this operation; if not - it should return an error fault.
Thanks.
See Question&Answers more detail:os