Example #1
0
        internal static bool CheckAuthModule(ADExchangeServiceVirtualDirectory advdir, bool isChildVDirApplication, string moduleName)
        {
            DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(advdir.MetabasePath);
            bool           result;

            using (ServerManager serverManager = ServerManager.OpenRemote(IisUtility.GetHostName(advdir.MetabasePath)))
            {
                Configuration webConfiguration;
                if (isChildVDirApplication)
                {
                    webConfiguration = serverManager.Sites[IisUtility.GetWebSiteName(directoryEntry.Parent.Parent.Path)].Applications[string.Format("/{0}/{1}", directoryEntry.Parent.Name, directoryEntry.Name)].GetWebConfiguration();
                }
                else
                {
                    webConfiguration = serverManager.Sites[IisUtility.GetWebSiteName(directoryEntry.Parent.Path)].Applications["/" + directoryEntry.Name].GetWebConfiguration();
                }
                ConfigurationElementCollection collection = webConfiguration.GetSection("system.webServer/modules").GetCollection();
                foreach (ConfigurationElement configurationElement in collection)
                {
                    if (string.Equals(configurationElement.Attributes["name"].Value.ToString(), moduleName, StringComparison.Ordinal))
                    {
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }
Example #2
0
 protected override void SetDefaultAuthenticationMethods(ADExchangeServiceVirtualDirectory virtualDirectory)
 {
     virtualDirectory.BasicAuthentication = new bool?(true);
     virtualDirectory.WindowsAuthentication = new bool?(false);
     virtualDirectory.DigestAuthentication = new bool?(false);
     virtualDirectory.LiveIdBasicAuthentication = new bool?(false);
     virtualDirectory.LiveIdNegotiateAuthentication = new bool?(false);
     virtualDirectory.WSSecurityAuthentication = new bool?(false);
 }
Example #3
0
        protected override IConfigurable PrepareDataObject()
        {
            ADExchangeServiceVirtualDirectory adexchangeServiceVirtualDirectory = (ADExchangeServiceVirtualDirectory)base.PrepareDataObject();

            adexchangeServiceVirtualDirectory.BasicAuthentication           = (bool?)base.Fields["BasicAuthentication"];
            adexchangeServiceVirtualDirectory.DigestAuthentication          = (bool?)base.Fields["DigestAuthentication"];
            adexchangeServiceVirtualDirectory.WindowsAuthentication         = (bool?)base.Fields["WindowsAuthentication"];
            adexchangeServiceVirtualDirectory.LiveIdBasicAuthentication     = (bool?)base.Fields["LiveIdBasicAuthentication"];
            adexchangeServiceVirtualDirectory.LiveIdNegotiateAuthentication = (bool?)base.Fields["LiveIdNegotiateAuthentication"];
            adexchangeServiceVirtualDirectory.OAuthAuthentication           = (bool?)base.Fields["OAuthAuthentication"];
            return(adexchangeServiceVirtualDirectory);
        }
 protected override void InternalProcessComplete()
 {
     base.InternalProcessComplete();
     if (this.CertificateAuthentication)
     {
         T dataObject = this.DataObject;
         dataObject.CertificateAuthentication = new bool?(true);
         ADExchangeServiceVirtualDirectory virtualDirectory = this.DataObject;
         Task.TaskErrorLoggingDelegate     errorHandler     = new Task.TaskErrorLoggingDelegate(base.WriteError);
         T dataObject2 = this.DataObject;
         ExchangeServiceVDirHelper.SetIisVirtualDirectoryAuthenticationMethods(virtualDirectory, errorHandler, Strings.ErrorUpdatingVDir(dataObject2.MetabasePath, string.Empty));
     }
 }
Example #5
0
        protected override void SetDefaultAuthenticationMethods(ADExchangeServiceVirtualDirectory virtualDirectory)
        {
            virtualDirectory.WindowsAuthentication         = new bool?(false);
            virtualDirectory.BasicAuthentication           = new bool?(false);
            virtualDirectory.DigestAuthentication          = new bool?(false);
            virtualDirectory.LiveIdNegotiateAuthentication = new bool?(false);
            virtualDirectory.WSSecurityAuthentication      = new bool?(false);
            virtualDirectory.OAuthAuthentication           = new bool?(this.OAuthAuthentication);
            ADO365SuiteServiceVirtualDirectory ado365SuiteServiceVirtualDirectory = (ADO365SuiteServiceVirtualDirectory)virtualDirectory;

            ado365SuiteServiceVirtualDirectory.LiveIdAuthentication = this.LiveIdAuthentication;
            if (this.IsBackEnd)
            {
                virtualDirectory.WindowsAuthentication = new bool?(true);
            }
        }
Example #6
0
        protected override IConfigurable PrepareDataObject()
        {
            ADExchangeServiceVirtualDirectory adexchangeServiceVirtualDirectory = (ADExchangeServiceVirtualDirectory)base.PrepareDataObject();

            if (base.Fields["BasicAuthentication"] == null && base.Fields["DigestAuthentication"] == null && base.Fields["WindowsAuthentication"] == null)
            {
                this.SetDefaultAuthenticationMethods(adexchangeServiceVirtualDirectory);
            }
            else
            {
                adexchangeServiceVirtualDirectory.BasicAuthentication   = new bool?(this.BasicAuthentication);
                adexchangeServiceVirtualDirectory.DigestAuthentication  = new bool?(this.DigestAuthentication);
                adexchangeServiceVirtualDirectory.WindowsAuthentication = new bool?(this.WindowsAuthentication);
            }
            return(adexchangeServiceVirtualDirectory);
        }
Example #7
0
        protected override void ProcessMetabaseProperties(ExchangeVirtualDirectory dataObject)
        {
            TaskLogger.LogEnter();
            base.ProcessMetabaseProperties(dataObject);
            ADExchangeServiceVirtualDirectory adexchangeServiceVirtualDirectory = (ADExchangeServiceVirtualDirectory)dataObject;

            try
            {
                DirectoryEntry directoryEntry2;
                DirectoryEntry directoryEntry = directoryEntry2 = IisUtility.CreateIISDirectoryEntry(adexchangeServiceVirtualDirectory.MetabasePath, new Task.TaskErrorLoggingReThrowDelegate(this.WriteError), dataObject.Identity, false);
                try
                {
                    if (directoryEntry != null)
                    {
                        adexchangeServiceVirtualDirectory.BasicAuthentication           = new bool?(IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Basic));
                        adexchangeServiceVirtualDirectory.DigestAuthentication          = new bool?(IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Digest));
                        adexchangeServiceVirtualDirectory.WindowsAuthentication         = new bool?(IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Ntlm));
                        adexchangeServiceVirtualDirectory.LiveIdNegotiateAuthentication = new bool?(IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.LiveIdNegotiate));
                        adexchangeServiceVirtualDirectory.LiveIdBasicAuthentication     = new bool?(adexchangeServiceVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.LiveIdBasic));
                        adexchangeServiceVirtualDirectory.OAuthAuthentication           = new bool?(adexchangeServiceVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.OAuth));
                        adexchangeServiceVirtualDirectory.AdfsAuthentication            = new bool?(adexchangeServiceVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Adfs));
                        adexchangeServiceVirtualDirectory.WSSecurityAuthentication      = new bool?(adexchangeServiceVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.WSSecurity) && IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.WSSecurity));
                    }
                }
                finally
                {
                    if (directoryEntry2 != null)
                    {
                        ((IDisposable)directoryEntry2).Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                TaskLogger.Trace("Exception occurred: {0}", new object[]
                {
                    ex.Message
                });
                base.WriteError(new LocalizedException(this.MetabaseGetPropertiesFailureMessage, ex), ErrorCategory.InvalidOperation, dataObject.Identity);
            }
            finally
            {
                TaskLogger.LogExit();
            }
        }
 protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     base.InternalEnableLiveIdNegotiateAuxiliaryModule();
     if (base.Fields["CertificateAuthentication"] != null)
     {
         T dataObject = this.DataObject;
         dataObject.CertificateAuthentication = new bool?((bool)base.Fields["CertificateAuthentication"]);
         ADExchangeServiceVirtualDirectory virtualDirectory = this.DataObject;
         Task.TaskErrorLoggingDelegate     errorHandler     = new Task.TaskErrorLoggingDelegate(base.WriteError);
         T dataObject2 = this.DataObject;
         ExchangeServiceVDirHelper.SetIisVirtualDirectoryAuthenticationMethods(virtualDirectory, errorHandler, Strings.ErrorUpdatingVDir(dataObject2.MetabasePath, string.Empty));
         T dataObject3 = this.DataObject;
         ExchangeServiceVDirHelper.ConfigureAnonymousAuthentication(dataObject3.MetabasePath, false);
     }
     if (base.Fields["EnableCertificateHeaderAuthModule"] != null)
     {
         base.SetCertificateHeaderAuthenticationModule(this.EnableCertificateHeaderAuthModule, false);
     }
 }
Example #9
0
        protected override void InternalProcessComplete()
        {
            ADExchangeServiceVirtualDirectory adexchangeServiceVirtualDirectory = this.DataObject;

            base.InternalProcessComplete();
            ExchangeServiceVDirHelper.SetIisVirtualDirectoryAuthenticationMethods(adexchangeServiceVirtualDirectory, new Task.TaskErrorLoggingDelegate(base.WriteError), this.MetabaseSetPropertiesFailureMessage);
            T dataObject = this.DataObject;

            if (dataObject.LiveIdBasicAuthentication != null)
            {
                T dataObject2 = this.DataObject;
                ExchangeServiceVDirHelper.SetLiveIdBasicAuthModule(dataObject2.LiveIdBasicAuthentication.Value, false, adexchangeServiceVirtualDirectory);
            }
            T dataObject3 = this.DataObject;

            if (dataObject3.OAuthAuthentication != null)
            {
                T dataObject4 = this.DataObject;
                ExchangeServiceVDirHelper.SetOAuthAuthenticationModule(dataObject4.OAuthAuthentication.Value, false, adexchangeServiceVirtualDirectory);
            }
            ExchangeServiceVDirHelper.CheckAndUpdateWindowsAuthProvidersIfNecessary(adexchangeServiceVirtualDirectory, new bool?(true));
        }
Example #10
0
 protected virtual void SetDefaultAuthenticationMethods(ADExchangeServiceVirtualDirectory virtualDirectory)
 {
     virtualDirectory.WindowsAuthentication = new bool?(true);
 }
Example #11
0
 protected override void SetDefaultAuthenticationMethods(ADExchangeServiceVirtualDirectory virtualDirectory)
 {
     virtualDirectory.BasicAuthentication   = new bool?(false);
     virtualDirectory.WindowsAuthentication = new bool?(false);
 }