Beispiel #1
0
        /// <summary>
        /// Co-ordinates check of authorization and handles Auth failure.  Should rarely be overridden.
        /// </summary>
        /// <param name="actionContext"></param>
        protected virtual void OnAuthorization(HttpActionContext actionContext)
        {
            Requires.NotNull("actionContext", actionContext);

            const string failureMessage = "Authorization has been denied for this request.";
            var authFilterContext = new AuthFilterContext(actionContext, failureMessage);
            if (!IsAuthorized(authFilterContext))
            {
                authFilterContext.HandleUnauthorizedRequest();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Co-ordinates check of authorization and handles Auth failure.  Should rarely be overridden.
        /// </summary>
        /// <param name="actionContext"></param>
        protected virtual void OnAuthorization(HttpActionContext actionContext)
        {
            Requires.NotNull("actionContext", actionContext);

            const string failureMessage    = "Authorization has been denied for this request.";
            var          authFilterContext = new AuthFilterContext(actionContext, failureMessage);

            if (!IsAuthorized(authFilterContext))
            {
                authFilterContext.HandleUnauthorizedRequest();
            }
        }
        /// <summary>
        /// Called by framework at start of Auth process, check if auth should be skipped and handles auth failure.  Should rarely need to be overridden.
        /// </summary>
        /// <param name="actionContext"></param>
        public override void OnAuthorization(HttpActionContext actionContext)
        {
            Requires.NotNull("actionContext", actionContext);

            if (SkipAuthorization(actionContext))
            {
                return;
            }

            const string failureMessage = "Authorization has been denied for this request.";
            var authFilterContext = new AuthFilterContext(actionContext, failureMessage);
            if (!IsAuthorized(authFilterContext))
            {
                authFilterContext.HandleUnauthorizedRequest();
            }
        }
        /// <summary>
        /// Called by framework at start of Auth process, check if auth should be skipped and handles auth failure.  Should rarely need to be overridden.
        /// </summary>
        /// <param name="actionContext"></param>
        public override void OnAuthorization(HttpActionContext actionContext)
        {
            Requires.NotNull("actionContext", actionContext);

            if (SkipAuthorization(actionContext))
            {
                return;
            }

            const string failureMessage    = "Authorization has been denied for this request.";
            var          authFilterContext = new AuthFilterContext(actionContext, failureMessage);

            if (!IsAuthorized(authFilterContext))
            {
                authFilterContext.HandleUnauthorizedRequest();
            }
        }