コード例 #1
0
        public static Uri FixIntegratedAuthUrlForBackEnd(Uri url)
        {
            if (!UrlUtilities.IsIntegratedAuthUrl(url))
            {
                return(url);
            }
            UriBuilder uriBuilder   = new UriBuilder(url);
            string     absolutePath = url.AbsolutePath;
            int        num          = url.AbsolutePath.IndexOf(Constants.IntegratedAuthPath, StringComparison.OrdinalIgnoreCase);

            uriBuilder.Path = absolutePath.Substring(0, num) + absolutePath.Substring(num + Constants.IntegratedAuthPath.Length);
            return(uriBuilder.Uri);
        }
コード例 #2
0
        protected override void OnEndRequestInternal(HttpApplication httpApplication)
        {
            HttpRequest          request  = httpApplication.Context.Request;
            HttpResponse         response = httpApplication.Context.Response;
            RequestDetailsLogger current  = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpApplication.Context);

            if (httpApplication.Context.Items[Constants.RequestCompletedHttpContextKeyName] == null && !UrlUtilities.IsIntegratedAuthUrl(request.Url) && !UrlUtilities.IsOwaMiniUrl(request.Url) && (response.StatusCode == 401 || (HttpProxyGlobals.ProtocolType == ProtocolType.Ecp && (response.StatusCode == 403 || response.StatusCode == 404))))
            {
                FbaModule.LogonReason reason = FbaModule.LogonReason.None;
                if (request.Headers["Authorization"] != null)
                {
                    reason = FbaModule.LogonReason.InvalidCredentials;
                }
                bool flag = request.Url.AbsolutePath.Equals("/owa/auth.owa", StringComparison.OrdinalIgnoreCase);
                if (request.HttpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase) || flag)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(current, "NoCookies", "302 - GET/E14AuthPost");

                    this.RedirectToFbaLogon(httpApplication, reason);
                }
                else if (request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase))
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(current, "NoCookies", "440 - POST");

                    this.Send440Response(httpApplication, true);
                }
                else
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(current, "NoCookies", "440 - " + request.HttpMethod);

                    this.Send440Response(httpApplication, false);
                }
            }
            base.OnEndRequestInternal(httpApplication);
        }