Beispiel #1
0
        internal static int GetMserveEntryTenantNegoConfig(string domainName)
        {
            IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(null);
            bool flag;

            if (!globalSession.TryGetDomainFlag(domainName, GlsDomainFlags.Nego2Enabled, out flag))
            {
                return(-1);
            }
            if (!flag)
            {
                return(0);
            }
            return(1);
        }
        private IGlobalDirectorySession GlobalDirectorySession(string redirectFormatForMServ = null)
        {
            switch (this.GlobalDirectoryService)
            {
            case GlobalDirectoryServiceType.Default:
                return(DirectorySessionFactory.GetGlobalSession(redirectFormatForMServ));

            case GlobalDirectoryServiceType.MServ:
                return(new MServDirectorySession(redirectFormatForMServ));

            case GlobalDirectoryServiceType.Gls:
                return(new GlsDirectorySession());

            default:
                throw new ArgumentException("GlobalDirectoryService");
            }
        }
Beispiel #3
0
        internal static string GetRedirectServer(string redirectFormat, string address, int currentSiteId, int startRange, int endRange, bool overrideCurrentSiteCheck, bool throwExceptions)
        {
            string result;

            try
            {
                IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(redirectFormat);
                result = globalSession.GetRedirectServer(address);
            }
            catch (MServTransientException)
            {
                if (throwExceptions)
                {
                    throw;
                }
                result = string.Empty;
            }
            catch (MServPermanentException)
            {
                if (throwExceptions)
                {
                    throw;
                }
                result = string.Empty;
            }
            catch (InvalidOperationException)
            {
                if (throwExceptions)
                {
                    throw;
                }
                result = string.Empty;
            }
            catch (TransientException)
            {
                if (throwExceptions)
                {
                    throw;
                }
                result = string.Empty;
            }
            return(result);
        }
Beispiel #4
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (this.makeDefault && !this.DataObject.Default)
            {
                this.DataObject.Default = true;
                ADPagedReader <AcceptedDomain> adpagedReader = ((IConfigurationSession)base.DataSession).FindPaged <AcceptedDomain>(this.DataObject.Id.Parent, QueryScope.OneLevel, null, null, 0);
                foreach (AcceptedDomain acceptedDomain in adpagedReader)
                {
                    if (acceptedDomain.Default)
                    {
                        acceptedDomain.Default = false;
                        base.DataSession.Save(acceptedDomain);
                    }
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.IsCoexistenceDomain) && this.DataObject.IsCoexistenceDomain != this.IsCoexistenceDomain)
            {
                if (!this.IsCoexistenceDomain)
                {
                    try
                    {
                        AcceptedDomainUtility.DeregisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                        goto IL_162;
                    }
                    catch (TimeoutException exception)
                    {
                        base.WriteError(exception, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (InvalidOperationException exception2)
                    {
                        base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (SecurityAccessDeniedException exception3)
                    {
                        base.WriteError(exception3, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (CommunicationException exception4)
                    {
                        base.WriteError(exception4, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                }
                try
                {
                    AcceptedDomainUtility.RegisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                }
                catch (TimeoutException exception5)
                {
                    base.WriteError(exception5, ErrorCategory.InvalidArgument, null);
                }
                catch (InvalidOperationException exception6)
                {
                    base.WriteError(exception6, ErrorCategory.InvalidArgument, null);
                }
                catch (SecurityAccessDeniedException exception7)
                {
                    base.WriteError(exception7, ErrorCategory.InvalidArgument, null);
                }
                catch (CommunicationException exception8)
                {
                    base.WriteError(exception8, ErrorCategory.InvalidArgument, null);
                }
IL_162:
                this.DataObject.IsCoexistenceDomain = this.IsCoexistenceDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawAuthenticationType))
            {
                this.DataObject.RawAuthenticationType = this.AuthenticationType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.InitialDomain))
            {
                this.DataObject.InitialDomain = this.InitialDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawLiveIdInstanceType))
            {
                this.DataObject.RawLiveIdInstanceType = this.LiveIdInstanceType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.EnableNego2Authentication))
            {
                this.DataObject.EnableNego2Authentication = this.EnableNego2Authentication;
                if (ManagementEndpointBase.IsGlobalDirectoryConfigured())
                {
                    IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(null);
                    globalSession.SetDomainFlag(this.DataObject.Name, GlsDomainFlags.Nego2Enabled, this.EnableNego2Authentication);
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient))
            {
                if (this.resolvedCatchAllRecipient != null)
                {
                    this.DataObject.CatchAllRecipientID = this.resolvedCatchAllRecipient.OriginalId;
                }
                else
                {
                    this.DataObject.CatchAllRecipientID = null;
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains))
            {
                this.DataObject.MatchSubDomains = this.MatchSubDomains;
            }
            base.InternalProcessRecord();
            FfoDualWriter.SaveToFfo <AcceptedDomain>(this, this.DataObject, TenantSettingSyncLogType.SYNCACCEPTEDDOM, null);
            TaskLogger.LogExit();
        }