コード例 #1
0
        public override void OnActionExecuted(ActionExecutedContext filterContext) {
            var isArmed = Convert.ToBoolean(ConfigurationManager.AppSettings["IsArmed"]);
            if (!isArmed) return;

            var armorFortify = new ArmorFortify(new MvcIdentityReaderFactory(filterContext.HttpContext.User), filterContext.HttpContext.ApplicationInstance.Context);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
                base.OnActionExecuted(filterContext);
            else filterContext.Result = new HttpUnauthorizedResult();
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) {
            var isArmed = Convert.ToBoolean(ConfigurationManager.AppSettings["IsArmed"]);
            if (!isArmed) return;

            var armorFortify = new ArmorFortify(new WebApiIdentityReaderFactory(Thread.CurrentPrincipal), HttpContext.Current);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
                base.OnActionExecuted(actionExecutedContext);
            else throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }
コード例 #3
0
        public override void OnActionExecuted(
            ActionExecutedContext filterContext) {
            if (!ArmorSettings.IsArmed) return;

            var armorFortify =
                new ArmorFortify(
                    new MvcIdentityReaderFactory(filterContext.HttpContext.User),
                    filterContext.HttpContext.ApplicationInstance.Context);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
                base.OnActionExecuted(filterContext);
            else filterContext.Result = new HttpUnauthorizedResult();
        }
コード例 #4
0
        public override void OnActionExecuted(
            HttpActionExecutedContext actionExecutedContext) {
            if (!ArmorSettings.IsArmed) return;

            var armorFortify =
                new ArmorFortify(
                    new WebApiIdentityReaderFactory(Thread.CurrentPrincipal),
                    HttpContext.Current);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
                base.OnActionExecuted(actionExecutedContext);
            else throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }
コード例 #5
0
        public override void OnActionExecuted(
            HttpActionExecutedContext actionExecutedContext)
        {
            if (!ArmorSettings.IsArmed)
            {
                return;
            }

            var armorFortify =
                new ArmorFortify(
                    new WebApiIdentityReaderFactory(Thread.CurrentPrincipal),
                    HttpContext.Current);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
            {
                base.OnActionExecuted(actionExecutedContext);
            }
            else
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }
        }
コード例 #6
0
        public override void OnActionExecuted(
            ActionExecutedContext filterContext)
        {
            if (!ArmorSettings.IsArmed)
            {
                return;
            }

            var armorFortify =
                new ArmorFortify(
                    new MvcIdentityReaderFactory(filterContext.HttpContext.User),
                    filterContext.HttpContext.ApplicationInstance.Context);
            var isFortified = armorFortify.TryFortify();

            if (isFortified)
            {
                base.OnActionExecuted(filterContext);
            }
            else
            {
                filterContext.Result = new HttpUnauthorizedResult();
            }
        }