private void ProcessAuthorization(HttpContextBase httpContext)
        {
            if (!_requestEvaluator.GetRequestIsAppropriateForCasAuthentication(httpContext))
            {
                Logger.Debug("No EndRequest processing for {0}", httpContext.Request.RawUrl);
                return;
            }

            if (_requestEvaluator.GetRequestHasCasTicket(httpContext))
            {
                Logger.Information("Processing Proxy Callback request");
                _casClient.ProcessTicketValidation(httpContext);
            }

            Logger.Debug("Starting AuthenticateRequest for {0}", httpContext.Request.RawUrl);
            _casClient.ProcessRequestAuthentication(httpContext);
            Logger.Debug("Ending AuthenticateRequest for {0}", httpContext.Request.RawUrl);
        }
Ejemplo n.º 2
0
        public ActionResult OnActionExecuted(WorkContext workContext)
        {
            var httpContext = workContext.HttpContext;

            if (_requestEvaluator.GetRequestRequiresGateway(httpContext, _casClient.GetGatewayStatus(httpContext)))
            {
                Logger.Information("  Performing Gateway Authentication");
                return(_casClient.GatewayAuthenticate(httpContext, true));
            }
            if (_requestEvaluator.GetUserDoesNotAllowSessionCookies(httpContext, _casClient.GetGatewayStatus(httpContext)))
            {
                Logger.Information("  Cookies not supported.  Redirecting to Cookies Required Page");
                return(_casClient.RedirectToCookiesRequiredPage());
            }
            if (_requestEvaluator.GetRequestHasCasTicket(httpContext))
            {
                Logger.Information("  Redirecting from login callback");
                //redirectRequest = _casClient.RedirectFromLoginCallback(context, filterContext.Result);
            }
            else if (_requestEvaluator.GetRequestHasGatewayParameter(httpContext))
            {
                Logger.Information("  Redirecting from failed gateway callback");
                return(_casClient.RedirectFromFailedGatewayCallback(httpContext));
            }
            else if (_requestEvaluator.GetRequestIsUnauthorized(httpContext) &&
                     !String.IsNullOrEmpty(_casServices.Settings.NotAuthorizedUrl))
            {
                Logger.Information("  Redirecting to Unauthorized Page");
                return(_casClient.RedirectToNotAuthorizedPage());
            }
            else if (_requestEvaluator.GetRequestIsUnauthorized(httpContext))
            {
                Logger.Information("  Redirecting to CAS Login Page (Unauthorized without NotAuthorizedUrl defined)");
                return(_casClient.RedirectToLoginPage(true));
            }
            else if (_requestEvaluator.GetRequestIsUnAuthenticated(httpContext))
            {
                Logger.Information("  Redirecting to CAS Login Page");
                return(_casClient.RedirectToLoginPage());
            }

            return(null);
        }