// Token: 0x0600004C RID: 76 RVA: 0x00002C74 File Offset: 0x00000E74
        public string GetHostNameFromVdir(ADObjectId serverSiteId, string protocol)
        {
            SupportedProtocol supportedProtocol;

            Enum.TryParse <SupportedProtocol>(protocol, true, out supportedProtocol);
            Uri externalUrl;

            switch (supportedProtocol)
            {
            case SupportedProtocol.Unknown:
                throw AutoDiscoverResponseException.BadRequest("InvalidProtocol", string.Format("The given protocol value '{0}' is invalid. Supported values are '{1}'", protocol, "ActiveSync, Ews"), null);

            case SupportedProtocol.Rest:
                throw AutoDiscoverResponseException.NotFound("MailboxNotEnabledForRESTAPI", "REST API is not yet supported for this mailbox.", null);

            case SupportedProtocol.ActiveSync:
                externalUrl = GlobalServiceUrls.GetExternalUrl <MobileSyncService>();
                break;

            case SupportedProtocol.Ews:
                externalUrl = GlobalServiceUrls.GetExternalUrl <WebServicesService>();
                break;

            default:
                throw new ArgumentException("Invalid Protocol specified", protocol);
            }
            return(externalUrl.Host);
        }
Esempio n. 2
0
 // Token: 0x0600000D RID: 13 RVA: 0x000023D1 File Offset: 0x000005D1
 public override bool Validate(HttpContextBase context)
 {
     if (context.Request.Url.AbsolutePath.EndsWith("v1.0", StringComparison.OrdinalIgnoreCase))
     {
         throw AutoDiscoverResponseException.BadRequest(HttpStatusCode.BadRequest.ToString(), "Id segment is missing in the URL", null);
     }
     return(true);
 }
Esempio n. 3
0
 // Token: 0x0600003F RID: 63 RVA: 0x00002A6C File Offset: 0x00000C6C
 internal void ValidateRequest(string emailAddress, string protocol, uint redirectCount, RequestDetailsLogger logger)
 {
     if (string.IsNullOrWhiteSpace(protocol))
     {
         throw AutoDiscoverResponseException.BadRequest("MandatoryParameterMissing", "A valid value must be provided for the query parameter 'Protocol'", null);
     }
     if (string.IsNullOrWhiteSpace(emailAddress))
     {
         throw AutoDiscoverResponseException.BadRequest("MandatoryParameterMissing", "A valid smtp address must be provided", null);
     }
     logger.Set(ServiceCommonMetadata.AuthenticatedUser, emailAddress);
     logger.AppendGenericInfo("RequestedProtocol", protocol);
     if (!SmtpAddress.IsValidSmtpAddress(emailAddress))
     {
         throw AutoDiscoverResponseException.BadRequest("InvalidUserId", string.Format("The given SMTP address is invalid '{0}'", emailAddress), null);
     }
     if (redirectCount >= 10U)
     {
         logger.AppendGenericError("RedirectCountExceeded", "Redirect count exceeded for the given user");
         throw AutoDiscoverResponseException.NotFound();
     }
 }
        // Token: 0x06000043 RID: 67 RVA: 0x00002BCC File Offset: 0x00000DCC
        private static string GetResourceUrlSuffixForProtocol(string protocol, string hostName)
        {
            SupportedProtocol supportedProtocol;

            Enum.TryParse <SupportedProtocol>(protocol, true, out supportedProtocol);
            switch (supportedProtocol)
            {
            case SupportedProtocol.Unknown:
                throw AutoDiscoverResponseException.BadRequest("InvalidProtocol", string.Format("The given protocol value '{0}' is invalid. Supported values are '{1}'", protocol, "ActiveSync, Ews"), null);

            case SupportedProtocol.Rest:
                throw AutoDiscoverResponseException.NotFound("MailboxNotEnabledForRESTAPI", "REST API is not yet supported for this mailbox.", null);

            case SupportedProtocol.ActiveSync:
                return("/Microsoft-Server-ActiveSync");

            case SupportedProtocol.Ews:
                return("/EWS/Exchange.asmx");

            default:
                return(null);
            }
        }