/// <summary> /// Redirects the current request to the Cookies Required page /// </summary> public RedirectResult RedirectToCookiesRequiredPage() { return(new RedirectResult(_urlUtil.ResolveUrl(_casServices.Settings.CookiesRequiredUrl))); }
/// <summary> /// Determines whether the current request requires a Gateway authentication redirect /// </summary> /// <returns>True if the request requires Gateway authentication, otherwise False</returns> public bool GetRequestRequiresGateway(HttpContextBase httpContext, GatewayStatus status) { HttpRequestBase request = httpContext.Request; bool gatewayEnabled = _casServices.Settings.Gateway; bool gatewayWasNotAttempted = (status == GatewayStatus.NotAttempted); bool requestDoesNotHaveGatewayParameter = !GetRequestHasGatewayParameter(httpContext); bool cookiesRequiredUrlIsDefined = !String.IsNullOrEmpty(_casServices.Settings.CookiesRequiredUrl); bool requestIsNotCookiesRequiredUrl = !GetRequestIsCookiesRequiredUrl(httpContext); bool notAuthorizedUrlIsDefined = !String.IsNullOrEmpty(_casServices.Settings.NotAuthorizedUrl); bool requestIsNotAuthorizedUrl = notAuthorizedUrlIsDefined && request.RawUrl.StartsWith(_urlUtil.ResolveUrl(_casServices.Settings.NotAuthorizedUrl), true, CultureInfo.InvariantCulture); bool result = ( gatewayEnabled && gatewayWasNotAttempted && requestDoesNotHaveGatewayParameter && cookiesRequiredUrlIsDefined && requestIsNotCookiesRequiredUrl && !requestIsNotAuthorizedUrl ); return(result); }