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); }