Ejemplo n.º 1
0
        protected override bool OnBeforeAction(IEngineContext context, IController controller,
                                               IControllerContext controllerContext)
        {
            var authService = context.Services.GetService <IOAuthService>();

            AccessOutcome outcome = authService.AccessProtectedResource(context.Request);

            _threadOutcome = outcome;

            if (!outcome.Granted)
            {
                controllerContext.PropertyBag["outcome"] = outcome;
                throw Error.AccessDeniedToProtectedResource(outcome);
            }

            return(true);
        }