私はAuthorizeAttribute
、MVC のようなものを探しています。次のように使用できます。
[WebGet(UriTemplate = "data/{spageNumber}")]
[WebCache(CacheProfileName = "SampleProfile")]
[WcfAuthorize]
public IEnumerable<SampleItem> GetCollection(String spageNumber)
{
Int32 itemsPerPage = 10;
Int32 pageNumber = Int32.Parse(spageNumber);
return Enumerable.Range(pageNumber * itemsPerPage, itemsPerPage)
.Select(i => SampleItem.Create(i));
}
そのWcfAuthorizeAttribute
は、FormsAuthentication でユーザーを認証しようとし、コンテキストの IPrincipal を設定するか、HTTP 401 Unauthorized を返します。
を試してみましたIOperationBehavior
が、属性を設定したメソッドではなく、最初のメソッドで実行されます。
これを WCF REST でどのように実現できますか?
よろしく。
PS: スターター キットで RequestInterceptor の例を見たことがありますが、私が望むのは一部のメソッドのみに配置することです。この例は、すべての操作で実行するフィルターのように見えます。