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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…