REST WCF.net 4.0中的ActionFilterAttribute等效项
REST WCF.net 4.0中的ActionFilterAttribute等效项,wcf,rest,.net-4.0,Wcf,Rest,.net 4.0,WCF中的ActionFilterAttribute等价物是什么 我有一个休息服务,如下所示 [WebInvoke(Method = "POST", UriTemplate = "/")] public User CreateBookMark(BookMark bm) { User authenticateUser = GetUserSomeHow(); //do stuff } 我想把这个改成下面的 [WebInvoke(Method = "POST", UriTemplate
WCF
中的ActionFilterAttribute
等价物是什么
我有一个休息服务,如下所示
[WebInvoke(Method = "POST", UriTemplate = "/")]
public User CreateBookMark(BookMark bm)
{
User authenticateUser = GetUserSomeHow();
//do stuff
}
我想把这个改成下面的
[WebInvoke(Method = "POST", UriTemplate = "/")]
public User CreateBookMark(BookMark bm, User authenticateUser)
{
//do stuff
}
创建一个自定义服务行为(IServiceBehavior)——该行为连接一个自定义操作行为(IOperationBehavior),该行为将注入额外的参数。您可能也想实现自己的AuthorizationManager,但最有可能的是您可以使用这些功能(OperationContext.Current.SecurityContext和System.Threading.Thread.CurrentPrincipal)。您有这样做的示例吗?