示例#1
0
 // Token: 0x060000FE RID: 254 RVA: 0x00004498 File Offset: 0x00002698
 public ConnectResponse(AutodiscoverResponse autodiscoverResponse, AutodiscoverOption autodiscoverOption)
 {
     this.AutodiscoverResponse = autodiscoverResponse;
     this.AutodiscoverOption   = autodiscoverOption;
     this.HttpStatus           = autodiscoverResponse.HttpStatus;
     this.ConnectStatus        = ((autodiscoverResponse.HttpStatus == HttpStatus.OK && autodiscoverResponse.AutodiscoverStatus == AutodiscoverStatus.Success) ? ConnectStatus.Success : ConnectStatus.AutodiscoverFailed);
 }
        /// <summary>
        /// Facilitates the discovery of core account configuration information by using the user's Simple Mail Transfer Protocol (SMTP) address as the primary input
        /// </summary>
        /// <param name="request">An AutodiscoverRequest object that contains the request information.</param>
        /// <param name="contentType">Content Type that indicates the body's format</param>
        /// <returns>Autodiscover command response</returns>
        public AutodiscoverResponse Autodiscover(AutodiscoverRequest request, ContentTypeEnum contentType)
        {
            AutodiscoverResponse response = this.activeSyncClient.Autodiscover(request, contentType);

            this.VerifyTransportRequirements();
            this.VerifyWBXMLCapture(CommandName.Autodiscover, response);
            this.VerifyAutodiscoverCommand(response);
            return(response);
        }
示例#3
0
        // Token: 0x060000F5 RID: 245 RVA: 0x00004338 File Offset: 0x00002538
        internal override ConnectResponse Execute(ConnectRequest connectRequest)
        {
            AutodiscoverRequest autodiscoverRequest = new AutodiscoverRequest();

            autodiscoverRequest.AutodiscoverOption   = connectRequest.AutodiscoverOption;
            autodiscoverRequest.Request.EMailAddress = base.EasConnectionSettings.EasEndpointSettings.UserSmtpAddressString;
            AutodiscoverCommand  autodiscoverCommand  = new AutodiscoverCommand(base.EasConnectionSettings);
            AutodiscoverResponse autodiscoverResponse = autodiscoverCommand.Execute(autodiscoverRequest);

            return(new ConnectResponse(autodiscoverResponse, connectRequest.AutodiscoverOption));
        }
示例#4
0
        protected override void HandleResponse(AutodiscoverResponse autodiscoverResponse)
        {
            GetDomainSettingsResponse getDomainSettingsResponse = (GetDomainSettingsResponse)autodiscoverResponse;

            if (getDomainSettingsResponse.DomainResponses == null || getDomainSettingsResponse.DomainResponses.Length != base.EmailAddresses.Length)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError <DomainSoapAutoDiscoverRequest>((long)this.GetHashCode(), "{0}: Response with no DomainResponses or unexpected number of DomainResponses", this);
                this.HandleException(new AutoDiscoverFailedException(Strings.descSoapAutoDiscoverInvalidResponseError(this.client.Url), 63804U));
                return;
            }
            SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceDebug <DomainSoapAutoDiscoverRequest>((long)this.GetHashCode(), "{0}: Received valid response.", this);
            AutoDiscoverRequestResult[] array = new AutoDiscoverRequestResult[base.EmailAddresses.Length];
            for (int i = 0; i < base.EmailAddresses.Length; i++)
            {
                array[i] = this.GetAutodiscoverResultFromDomainResponse(base.EmailAddresses[i], getDomainSettingsResponse.DomainResponses[i]);
            }
            base.HandleResult(array);
        }
示例#5
0
        protected override void HandleResponse(AutodiscoverResponse autodiscoverResponse)
        {
            GetUserSettingsResponse getUserSettingsResponse = (GetUserSettingsResponse)autodiscoverResponse;

            if (getUserSettingsResponse.UserResponses == null)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError <object, UserSoapAutoDiscoverRequest>((long)this.GetHashCode(), "{0}: Request '{1}' got response with no UserResponses", TraceContext.Get(), this);
                this.HandleException(new AutoDiscoverFailedException(Strings.descSoapAutoDiscoverInvalidResponseError(this.client.Url), 39740U));
                return;
            }
            if (getUserSettingsResponse.UserResponses.Length != base.EmailAddresses.Length)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError((long)this.GetHashCode(), "{0}: Request '{1}' got response with unexpected number of UserResponses EmailAddress length {2} UserResponses length{3}", new object[]
                {
                    TraceContext.Get(),
                    this,
                    base.EmailAddresses.Length,
                    getUserSettingsResponse.UserResponses.Length
                });
                for (int i = 0; i < getUserSettingsResponse.UserResponses.Length; i++)
                {
                    if (getUserSettingsResponse.UserResponses[i].ErrorCodeSpecified)
                    {
                        SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError((long)this.GetHashCode(), "{0}: UserResponses[{1}] ErrorCode {2} ErrorMessage {3}", new object[]
                        {
                            TraceContext.Get(),
                            i,
                            getUserSettingsResponse.UserResponses[i].ErrorCode,
                            getUserSettingsResponse.UserResponses[i].ErrorMessage
                        });
                    }
                }
                this.HandleException(new AutoDiscoverFailedException(Strings.descSoapAutoDiscoverInvalidResponseError(this.client.Url), 56124U));
                return;
            }
            SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceDebug <object, UserSoapAutoDiscoverRequest>((long)this.GetHashCode(), "{0}: Request '{1}' received valid response.", TraceContext.Get(), this);
            AutoDiscoverRequestResult[] array = new AutoDiscoverRequestResult[base.EmailAddresses.Length];
            for (int j = 0; j < base.EmailAddresses.Length; j++)
            {
                array[j] = this.GetAutodiscoverResultFromUserResponse(base.EmailAddresses[j], getUserSettingsResponse.UserResponses[j]);
            }
            base.HandleResult(array);
        }
示例#6
0
        protected override void EndInvoke(IAsyncResult asyncResult)
        {
            AutodiscoverResponse response = null;
            Exception            ex       = this.ExecuteAndHandleException(delegate
            {
                response = this.EndGetSettings(asyncResult);
            });
            Dictionary <string, string> responseHttpHeaders = this.client.ResponseHttpHeaders;

            if (responseHttpHeaders.ContainsKey(WellKnownHeader.XFEServer))
            {
                this.FrontEndServerName = responseHttpHeaders[WellKnownHeader.XFEServer];
            }
            if (responseHttpHeaders.ContainsKey(WellKnownHeader.XBEServer))
            {
                this.BackEndServerName = responseHttpHeaders[WellKnownHeader.XBEServer];
            }
            if (ex != null)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError <object, SoapAutoDiscoverRequest, Exception>((long)this.GetHashCode(), "{0}: Request '{1}' failed due exception: {2}", TraceContext.Get(), this, ex);
                this.HandleException(ex);
                return;
            }
            if (response == null)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError <object, SoapAutoDiscoverRequest>((long)this.GetHashCode(), "{0}: Request '{1}' succeeded, but received empty response", TraceContext.Get(), this);
                this.HandleException(new AutoDiscoverFailedException(Strings.descSoapAutoDiscoverInvalidResponseError(this.client.Url), 59196U));
                return;
            }
            if (response.ErrorCodeSpecified && response.ErrorCode != ErrorCode.NoError)
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError((long)this.GetHashCode(), "{0}: Request '{1}' failed with error {2}:{3}", new object[]
                {
                    TraceContext.Get(),
                    this,
                    response.ErrorCode,
                    response.ErrorMessage
                });
                this.HandleException(new AutoDiscoverFailedException(Strings.descSoapAutoDiscoverResponseError(this.client.Url, response.ErrorMessage), 34620U));
                return;
            }
            this.HandleResponse(response);
        }
        public void MSASCMD_S01_TC04_ErrorCode_601()
        {
            Site.Assume.IsFalse(Common.GetSutVersion(this.Site) == SutVersion.ExchangeServer2007 && string.Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site).ToUpper(CultureInfo.InvariantCulture), "HTTP"), "Autodiscover request should be passed only through HTTPS to Exchange Server 2007.");

            #region Calls Autodiscover command with two Request elements.
            AutodiscoverRequest request = new AutodiscoverRequest
            {
                RequestData = new Request.Autodiscover
                {
                    Request = new Request.RequestType
                    {
                        AcceptableResponseSchema = Common.GetConfigurationPropertyValue("AcceptableResponseSchema", Site) + "XX",
                        EMailAddress             = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain)
                    }
                }
            };

            AutodiscoverResponse response = this.CMDAdapter.Autodiscover(request, ContentTypeEnum.Xml);

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2285");

            Site.CaptureRequirementIfAreEqual <string>(
                "601",
                ((Response.AutodiscoverResponse)response.ResponseData.Item).Error.ErrorCode,
                2285,
                @"[In ErrorCode] If the provider cannot be found, [or if the AcceptableResponseSchema element (section 2.2.3.1) value cannot be matched,] then the ErrorCode element is included in the command response.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2288");

            Site.CaptureRequirementIfAreEqual <string>(
                "601",
                ((Response.AutodiscoverResponse)response.ResponseData.Item).Error.ErrorCode,
                2288,
                @"[In ErrorCode] A value of 601 means that a provider could not be found to handle the AcceptableResponseSchema element value that was specified.");

            #endregion
        }
        public void MSASCMD_S01_TC02_Autodiscover_Fail()
        {
            Site.Assume.IsFalse(Common.GetSutVersion(this.Site) == SutVersion.ExchangeServer2007 && string.Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site).ToUpper(CultureInfo.InvariantCulture), "HTTP"), "Autodiscover request should be passed only through HTTPS to Exchange Server 2007.");
            AutodiscoverRequest request = new AutodiscoverRequest
            {
                RequestData = new Request.Autodiscover
                {
                    Request = new Request.RequestType
                    {
                        AcceptableResponseSchema = Common.GetConfigurationPropertyValue("AcceptableResponseSchema", this.Site),
                        EMailAddress             = Common.GetMailAddress("InvallidEmailAddress", this.User1Information.UserDomain)
                    }
                }
            };

            AutodiscoverResponse response = CMDAdapter.Autodiscover(request, ContentTypeEnum.Xml);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3818");

            // An Error child element returned in Response element indicate an error occurs in the Autodiscover command framework that hosts the Autodiscovery implementation.
            // Verify MS-ASCMD requirement: MS-ASCMD_R3818
            Site.CaptureRequirementIfIsNotNull(
                ((Response.Response)response.ResponseData.Item).Action.Error,
                3818,
                @"[In Response(Autodiscover)] If an error occurs in the Autodiscover command framework that hosts the Autodiscovery implementation, then the Response element MUST have an Error child element.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4001");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4001
            Site.CaptureRequirementIfAreNotEqual <string>(
                "1",
                ((Response.Response)response.ResponseData.Item).Action.Error.Status,
                4001,
                @"[In Status(Autodiscover)] Because the Status element is only returned when the command encounters an error, the success status code is never included in a response message.");
        }
        public void MSASCMD_S01_TC01_Autodiscover_TypeIsMobileSync()
        {
            Site.Assume.IsFalse(Common.GetSutVersion(this.Site) == SutVersion.ExchangeServer2007 && string.Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site).ToUpper(CultureInfo.InvariantCulture), "HTTP"), "Autodiscover request should be passed only through HTTPS to Exchange Server 2007.");

            string acceptableResponseSchema = Common.GetConfigurationPropertyValue("AcceptableResponseSchema", Site);

            AutodiscoverRequest request = new AutodiscoverRequest
            {
                RequestData = new Request.Autodiscover
                {
                    Request = new Request.RequestType
                    {
                        AcceptableResponseSchema = acceptableResponseSchema,
                        EMailAddress             = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain)
                    }
                }
            };

            AutodiscoverResponse response = CMDAdapter.Autodiscover(request, ContentTypeEnum.Xml);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(response.ResponseDataXML);
            XmlElement xmlElement      = (XmlElement)xmlDoc.DocumentElement;
            string     schemaNameSpace = xmlElement.GetElementsByTagName("Response")[0].NamespaceURI;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R703");

            Site.CaptureRequirementIfAreEqual <string>(
                acceptableResponseSchema,
                schemaNameSpace,
                703,
                @"[In AcceptableResponseSchema] The AcceptableResponseSchema element is a required child element of the Request element in Autodiscover command requests that indicates the schema in which the server MUST send the response.");

            Site.Assert.AreEqual <string>("MobileSync", ((Response.Response)response.ResponseData.Item).Action.Settings[0].Type, "The type of Action in Autodiscover command response should be MobileSync.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3482");

            // If the Type element value is "MobileSync", then the Name element specifies the URL that conveys the protocol which specified by Url element.
            // Verify MS-ASCMD requirement: MS-ASCMD_R3482
            Site.CaptureRequirementIfAreEqual <string>(
                ((Response.Response)response.ResponseData.Item).Action.Settings[0].Url,
                ((Response.Response)response.ResponseData.Item).Action.Settings[0].Name,
                3482,
                @"[In Name(Autodiscover)] The Name element is an optional child element of the Server element in Autodiscover command responses that specifies a URL if the Type element (section 2.2.3.170.1) value is set to ""MobileSync"".");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3484");

            // If the Type element value is "MobileSync", then the Name element specifies the URL that conveys the protocol which specified by Url element.
            // Verify MS-ASCMD requirement: MS-ASCMD_R3484
            Site.CaptureRequirementIfAreEqual <string>(
                ((Response.Response)response.ResponseData.Item).Action.Settings[0].Url,
                ((Response.Response)response.ResponseData.Item).Action.Settings[0].Name,
                3484,
                @"[In Name(Autodiscover)] If the Type element value is ""MobileSync"", then the Name element specifies the URL that conveys the protocol.");

            if (Common.IsRequirementEnabled(5160, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5160");

                // Verify MS-ASCMD requirement: MS-ASCMD_R5160
                Site.CaptureRequirementIfAreEqual <string>(
                    "en:en",
                    ((Response.Response)response.ResponseData.Item).Culture,
                    5160,
                    "[In Appendix A: Product Behavior] Implementation does return the form \"en:en\" of Culture element, regardless of the culture that is sent by the client. (<26> Section 2.2.3.38: In Exchange 2007, the Culture element always returns \"en:en\", regardless of the culture that is sent by the client.)");
            }

            if (Common.IsRequirementEnabled(5823, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5823");

                // Verify MS-ASCMD requirement: MS-ASCMD_R5823
                Site.CaptureRequirementIfAreEqual <string>(
                    "en:us",
                    ((Response.Response)response.ResponseData.Item).Culture,
                    5823,
                    "[In Appendix A: Product Behavior] Implementation does return the form \"en:us\" of Culture element. (Exchange 2010 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(5718, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5718");

                // If the Response element do not have an Error child element when set the Content-Type header to "text/xml", it indicates an error does not occur in the Autodiscover command framework that hosts the Autodiscovery implementation.
                // Verify MS-ASCMD requirement: MS-ASCMD_R5718
                Site.CaptureRequirementIfIsNull(
                    ((Response.Response)response.ResponseData.Item).Action.Error,
                    5718,
                    "[In Appendix A: Product Behavior] When sending an Autodiscover command request to implementation, the Content-Type header does accept the following values: \"text/xml\". (Exchange 2007 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(5123, this.Site))
            {
                response = CMDAdapter.Autodiscover(request, ContentTypeEnum.Html);

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5123");

                // If the Response element do not have an Error child element when set the Content-Type header to "text/html", it indicates an error does not occur in the Autodiscover command framework that hosts the Autodiscovery implementation.
                // Verify MS-ASCMD requirement: MS-ASCMD_R5123
                Site.CaptureRequirementIfIsNull(
                    ((Response.Response)response.ResponseData.Item).Action.Error,
                    5123,
                    "[In Appendix A: Product Behavior] When sending an Autodiscover command request to implementation, the Content-Type header does accept the following values: \"text/html\" [or \"text/xml\"]. (<1> Section 2.2.2.1: When sending an Autodiscover command request to Exchange 2007, the Content-Type header accepts the following values: \"text/html\" or \"text/xml\".)");
            }
        }
示例#10
0
 protected abstract void HandleResponse(AutodiscoverResponse response);