开发者

ActionFilterAttribute equivalent in REST WCF .net 4.0

what is the ActionFilterAttribute equivalent in WCF?

I have a REST service which looks like below

[WebInvoke(Method = "POST", UriTemplate = "/")]
p开发者_C百科ublic User CreateBookMark(BookMark bm)
{
  User authenticateUser = GetUserSomeHow();

  //do stuff

}

I want to change this to following

[WebInvoke(Method = "POST", UriTemplate = "/")]
public User CreateBookMark(BookMark bm, User authenticateUser)
{

  //do stuff

}


Create a custom service behavior (IServiceBehavior) - that hooks up a custom operation behavior (IOperationBehavior) that will inject the the extra parameter. It may be you also want to implement your own AuthorizationManager - but it's most likely that you can do with the features (OperationContext.Current.SecurityContext and System.Threading.Thread.CurrentPrincipal).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜