Example #1
0
        protected override void OnSendingProxyRequest(HttpContext context, HttpWebRequest request)
        {
            OutboundProxySession outboundProxySession = (OutboundProxySession)context.User;

            ExTraceGlobals.ProxyTracer.TraceInformation <string, Uri>(0, 0L, "Sending Proxy Request. User={0}, Url={1}", outboundProxySession.NameForEventLog, request.RequestUri);
            ProxyWebSession.AddSecurityContextHeader(request, outboundProxySession);
        }
Example #2
0
        private void SendProxyLogon()
        {
            ProxyConnection      proxyConnection = this.proxyConnections.Current;
            OutboundProxySession session         = (OutboundProxySession)this.Context.User;

            proxyConnection.ProxyWebSession.SendProxyLogon(proxyConnection.BaseUri, session, new Action <HttpStatusCode>(this.ProxyLogonResponseReceived), new Action <Exception>(this.ProxyLogonFailed));
        }
Example #3
0
        public void SendProxyLogon(Uri baseUri, OutboundProxySession session, Action <HttpStatusCode> onProxyLogonSucceeded, Action <Exception> onProxyLogonFailure)
        {
            Uri            requestUri = new Uri(baseUri, "proxyLogon.ecp");
            HttpWebRequest request    = base.CreateRequest(requestUri, "POST");

            ProxyWebSession.AddSecurityContextHeader(request, session);
            base.Send <HttpStatusCode>(request, new SerializedAccessTokenBody(session.RbacConfiguration.SecurityAccessToken), (HttpWebResponse response) => response.StatusCode, delegate(HttpStatusCode statusCode)
            {
                onProxyLogonSucceeded(statusCode);
            }, onProxyLogonFailure);
        }
Example #4
0
        private static void AddSecurityContextHeader(HttpWebRequest request, OutboundProxySession session)
        {
            request.Headers.Add("msExchLogonAccount", session.RbacConfiguration.SecurityAccessToken.UserSid);
            request.Headers.Add("msExchLogonMailbox", session.RbacConfiguration.LogonUserSid.Value);
            SecurityIdentifier securityIdentifier;

            if (!session.RbacConfiguration.TryGetExecutingUserSid(out securityIdentifier))
            {
                throw new ExecutingUserPropertyNotFoundException("executingUserSid");
            }
            request.Headers.Add("msExchTargetMailbox", securityIdentifier.Value);
            request.Headers.Add("msExchProxyUri", HttpContext.Current.Request.Url.ToEscapedString());
        }
Example #5
0
        protected override void OnProxyRequestFailed(HttpContext context, HttpWebRequest request, HttpWebResponse response, Exception exception)
        {
            OutboundProxySession outboundProxySession = (OutboundProxySession)context.User;

            ExTraceGlobals.ProxyTracer.TraceError <ADObjectId, Uri, Exception>(0, 0L, "Proxy Request Failed. User={0}, Url={1}, Exception={2}", outboundProxySession.ExecutingUserId, request.RequestUri, exception);
        }
Example #6
0
        protected override void OnProxyRequestSucceeded(HttpContext context, HttpWebRequest request)
        {
            OutboundProxySession outboundProxySession = (OutboundProxySession)context.User;

            ExTraceGlobals.ProxyTracer.TraceInformation <ADObjectId, Uri>(0, 0L, "Proxy Request Completed. User={0}, Url={1}", outboundProxySession.ExecutingUserId, request.RequestUri);
        }
Example #7
0
 public ProxyHandler(OutboundProxySession session)
 {
     this.session = session;
 }