public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)
        {
            //Method name
            var methodBase = input.MethodBase;

            //Plugin Controller Name
            var pluginType     = input.Target.GetType();
            var pluginTypeName = pluginType.Name;

            //Create claim
            string claim = pluginTypeName;

            //Check claim
            if (!UserClaimsManager.CheckUserClaim(claim))
            {
                throw new NotAuthorizedException("User doesn't have " + claim + " claim.");
            }

            // Invoke the next behavior in the chain.
            var result = getNext()(input, getNext);


            // After invoking the method on the original target.
            if (result.Exception != null)
            {
                var temp = result.Exception.Message;
            }
            else
            {
                var temp = result.ReturnValue;
            }

            return(result);
        }
        public List <string> GetPluginNames()
        {
            if (_userClaimsManager == null)
            {
                //TODO : Log : claim manager is null
                return(null);
            }

            var allowedPlugins = PluginNames.Where(x => _userClaimsManager.CheckUserClaim(x)).ToList();

            return(allowedPlugins);
        }
        public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)
        {
            //Method name
            var methodBase = input.MethodBase;

            //Plugin Controller Name
            var pluginControllerType = input.Target.GetType();
            IPluginController pluginControllerInstance = Activator.CreateInstance(pluginControllerType) as PluginControllerBase;

            if (pluginControllerInstance == null)
            {
                throw new InvalidCastException("Couldn't cast to IPluginController");
            }
            //var pluginControllerName = pluginControllerInstance.AssemblyName;
            var pluginControllerName = pluginControllerType.Name;

            //Plugin Name
            var pluginType = pluginControllerInstance.PluginType;
            var pluginName = pluginType.Name;

            //Create claim
            //TODO : Add method ?? InterceptionBehavior cause problem, searches for get_title claim
            string claim = pluginName + "/" + pluginControllerName;// + "/" + methodBase.Name;

            //Check claim
            if (!_userClaimsManager.CheckUserClaim(claim))
            {
                throw new NotAuthorizedException("User doesn't have " + claim + " claim.");
            }

            // Invoke the next behavior in the chain.
            var result = getNext()(input, getNext);


            // After invoking the method on the original target.
            if (result.Exception != null)
            {
                var temp = result.Exception.Message;
            }
            else
            {
                var temp = result.ReturnValue;
            }

            return(result);
        }