Beispiel #1
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            if (!this.IsInSetup && this.DataObject.ExchangeVersion.IsOlderThan(ADMobileVirtualDirectory.MinimumSupportedExchangeObjectVersion))
            {
                base.WriteError(new TaskException(Strings.ErrorSetOlderVirtualDirectory(this.DataObject.Identity.ToString(), this.DataObject.ExchangeVersion.ToString(), ADMobileVirtualDirectory.MinimumSupportedExchangeObjectVersion.ToString())), ErrorCategory.InvalidArgument, null);
            }
            string metabasePath = this.DataObject.MetabasePath;

            if (!IisUtility.Exists(metabasePath))
            {
                base.WriteError(new WebObjectNotFoundException(Strings.ErrorObjectNotFound(metabasePath)), ErrorCategory.ObjectNotFound, metabasePath);
                return;
            }
            if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject) && !this.IsInSetup)
            {
                bool flag = false;
                for (int i = 0; i < this.InvalidParametersOnMbxRole.Length; i++)
                {
                    if (base.Fields.Contains(this.InvalidParametersOnMbxRole[i]))
                    {
                        this.WriteError(new InvalidArgumentForServerRoleException(this.InvalidParametersOnMbxRole[i], DirectoryStrings.ServerRoleCafe), ErrorCategory.InvalidArgument, this.DataObject, false);
                        flag = true;
                    }
                }
                if (flag)
                {
                    return;
                }
            }
            bool flag2 = IisUtility.SSLEnabled(metabasePath);

            if (this.DataObject.BasicAuthEnabled && !flag2)
            {
                this.WriteWarning(Strings.WarnBasicAuthInClear);
            }
            if (this.DataObject.ClientCertAuth != ClientCertAuthTypes.Ignore && this.DataObject.ClientCertAuth != ClientCertAuthTypes.Accepted && this.DataObject.ClientCertAuth != ClientCertAuthTypes.Required)
            {
                base.WriteError(new ArgumentException(Strings.InvalidCertAuthValue, "ClientCertAuth"), ErrorCategory.InvalidArgument, null);
                return;
            }
            if (this.DataObject.ClientCertAuth == ClientCertAuthTypes.Required && !flag2)
            {
                base.WriteError(new ArgumentException(Strings.CertAuthWithoutSSLError, "ClientCertAuth"), ErrorCategory.InvalidArgument, null);
            }
        }
 protected override void ProcessMetabaseProperties(ExchangeVirtualDirectory dataObject)
 {
     TaskLogger.LogEnter();
     base.ProcessMetabaseProperties(dataObject);
     ((ADOabVirtualDirectory)dataObject).OAuthAuthentication = ((ADOabVirtualDirectory)dataObject).InternalAuthenticationMethods.Contains(AuthenticationMethod.OAuth);
     ((ADOabVirtualDirectory)dataObject).RequireSSL          = IisUtility.SSLEnabled(dataObject.MetabasePath);
     using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(dataObject.MetabasePath))
     {
         ((ADOabVirtualDirectory)dataObject).BasicAuthentication   = IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Basic);
         ((ADOabVirtualDirectory)dataObject).WindowsAuthentication = IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Ntlm);
     }
     dataObject.ResetChangeTracking();
     TaskLogger.LogExit();
 }
Beispiel #3
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            TaskLogger.LogEnter();
            ADOabVirtualDirectory adoabVirtualDirectory = (ADOabVirtualDirectory)dataObject;

            adoabVirtualDirectory.OAuthAuthentication = adoabVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.OAuth);
            adoabVirtualDirectory.RequireSSL          = IisUtility.SSLEnabled(adoabVirtualDirectory.MetabasePath);
            using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(adoabVirtualDirectory.MetabasePath))
            {
                adoabVirtualDirectory.BasicAuthentication   = IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Basic);
                adoabVirtualDirectory.WindowsAuthentication = IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Ntlm);
            }
            dataObject.ResetChangeTracking();
            base.StampChangesOn(dataObject);
            TaskLogger.LogExit();
        }