main
 1using System.Security.Principal;
 2using System.Threading;
 3using Castle.Core.Interceptor;
 4using Gorilla.Commons.Infrastructure.Logging;
 5using gorilla.commons.utility;
 6
 7namespace MoMoney.boot.container.registration.proxy_configuration
 8{
 9    public class SecuringProxy : IInterceptor
10    {
11        readonly Specification<IPrincipal> filter;
12
13        public SecuringProxy(Specification<IPrincipal> filter)
14        {
15            this.filter = filter;
16        }
17
18        public void Intercept(IInvocation invocation)
19        {
20            if (filter.is_satisfied_by(Thread.CurrentPrincipal)) invocation.Proceed();
21            else this.log().debug("call to {0} was blocked", invocation);
22        }
23    }
24}