コード例 #1
0
        // Token: 0x060003E6 RID: 998 RVA: 0x00016BE8 File Offset: 0x00014DE8
        internal static IRecipientSession GetRecipientSessionFromExternalDirectoryOrganizationId(LatencyTracker latencyTracker, Guid externalOrgId, RequestDetailsLogger logger)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (externalOrgId == Guid.Empty)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            ADSessionSettings sessionSettings = null;

            if (Utilities.IsPartnerHostedOnly || GlobalConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).WindowsLiveID.Enabled)
            {
                try
                {
                    sessionSettings = DirectoryHelper.CreateADSessionSettingsWithDiagnostics(() => ADSessionSettings.FromExternalDirectoryOrganizationId(externalOrgId), logger, latencyTracker, false);
                    goto IL_8F;
                }
                catch (CannotResolveExternalDirectoryOrganizationIdException ex)
                {
                    throw new HttpProxyException(HttpStatusCode.NotFound, 3009, ex.Message, ex);
                }
            }
            sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
IL_8F:
            return(DirectoryHelper.CreateSession(sessionSettings));
        }
コード例 #2
0
        internal static IRecipientSession GetRecipientSessionFromPartition(LatencyTracker latencyTracker, string partitionId)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (string.IsNullOrEmpty(partitionId))
            {
                throw new ArgumentNullException("partitionId");
            }
            ADSessionSettings adsessionSettings = null;
            PartitionId       partitionIdObject = null;

            if ((Utilities.IsPartnerHostedOnly || VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled) && PartitionId.TryParse(partitionId, out partitionIdObject))
            {
                try
                {
                    adsessionSettings = DirectoryHelper.ExecuteFunctionAndUpdateMovingAveragePerformanceCounter <ADSessionSettings>(PerfCounters.HttpProxyCountersInstance.MovingAverageTenantLookupLatency, () => DirectoryHelper.InvokeGls <ADSessionSettings>(latencyTracker, () => ADSessionSettings.FromAllTenantsPartitionId(partitionIdObject)));
                }
                catch (CannotResolvePartitionException arg)
                {
                    ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolvePartitionException>(0L, "[DirectoryHelper::GetRecipientSessionFromPartition] Caught CannotResolvePartitionException when resolving partition by partition ID {0}. Exception details: {1}.", partitionId, arg);
                }
            }
            if (adsessionSettings == null)
            {
                adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            return(DirectoryHelper.CreateSession(adsessionSettings));
        }
コード例 #3
0
        // Token: 0x060003E3 RID: 995 RVA: 0x00016A28 File Offset: 0x00014C28
        internal static IRecipientSession GetRecipientSessionFromPartition(LatencyTracker latencyTracker, string partitionId, RequestDetailsLogger logger)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (string.IsNullOrEmpty(partitionId))
            {
                throw new ArgumentNullException("partitionId");
            }
            ADSessionSettings adsessionSettings = null;
            PartitionId       partitionIdObject = null;

            if ((Utilities.IsPartnerHostedOnly || GlobalConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).MultiTenancy.Enabled) && PartitionId.TryParse(partitionId, ref partitionIdObject))
            {
                try
                {
                    adsessionSettings = DirectoryHelper.CreateADSessionSettingsWithDiagnostics(() => ADSessionSettings.FromAllTenantsPartitionId(partitionIdObject), logger, latencyTracker, true);
                }
                catch (CannotResolvePartitionException ex)
                {
                    if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(2))
                    {
                        ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolvePartitionException>(0L, "[DirectoryHelper::GetRecipientSessionFromPartition] Caught CannotResolvePartitionException when resolving partition by partition ID {0}. Exception details: {1}.", partitionId, ex);
                    }
                }
            }
            if (adsessionSettings == null)
            {
                adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            return(DirectoryHelper.CreateSession(adsessionSettings));
        }
コード例 #4
0
        internal static IRecipientSession GetRecipientSessionFromExternalDirectoryOrganizationId(LatencyTracker latencyTracker, Guid externalOrgId)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (externalOrgId == Guid.Empty)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            ADSessionSettings sessionSettings = null;

            if (!Utilities.IsPartnerHostedOnly)
            {
                if (!VariantConfiguration.InvariantNoFlightingSnapshot.Global.WindowsLiveID.Enabled)
                {
                    goto IL_A4;
                }
            }
            try
            {
                sessionSettings = DirectoryHelper.ExecuteFunctionAndUpdateMovingAveragePerformanceCounter <ADSessionSettings>(PerfCounters.HttpProxyCountersInstance.MovingAverageTenantLookupLatency, () => DirectoryHelper.InvokeGls <ADSessionSettings>(latencyTracker, () => ADSessionSettings.FromExternalDirectoryOrganizationId(externalOrgId)));
                goto IL_AA;
            }
            catch (CannotResolveExternalDirectoryOrganizationIdException ex)
            {
                throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.DomainNotFound, ex.Message, ex);
            }
IL_A4:
            sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
IL_AA:
            return(DirectoryHelper.CreateSession(sessionSettings));
        }
コード例 #5
0
        internal static IRecipientSession GetRecipientSessionFromOrganizationId(LatencyTracker latencyTracker, OrganizationId organizationId)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (organizationId == null)
            {
                organizationId = OrganizationId.ForestWideOrgId;
            }
            ADSessionSettings sessionSettings = DirectoryHelper.ExecuteFunctionAndUpdateMovingAveragePerformanceCounter <ADSessionSettings>(PerfCounters.HttpProxyCountersInstance.MovingAverageTenantLookupLatency, () => DirectoryHelper.InvokeGls <ADSessionSettings>(latencyTracker, () => ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId)));

            return(DirectoryHelper.CreateSession(sessionSettings));
        }
コード例 #6
0
        internal static IRecipientSession GetTenantRecipientSessionByMSAUserNetID(LatencyTracker latencyTracker, string msaUserNetID, bool ignoreCannotResolveMSAUserNetIDException, bool requestForestWideDomainControllerAffinityByUserId)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            NetID netID;

            if (!NetID.TryParse(msaUserNetID, out netID))
            {
                throw new ArgumentException("msaUserNetID");
            }
            ADSessionSettings sessionSettings = null;

            if (!Utilities.IsPartnerHostedOnly)
            {
                if (!VariantConfiguration.InvariantNoFlightingSnapshot.Global.WindowsLiveID.Enabled)
                {
                    goto IL_AE;
                }
            }
            try
            {
                sessionSettings = DirectoryHelper.CreateADTenantSessionSettingsByMSAUserNetID(latencyTracker, msaUserNetID);
                goto IL_B4;
            }
            catch (CannotResolveMSAUserNetIDException ex)
            {
                if (!ignoreCannotResolveMSAUserNetIDException)
                {
                    ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolveMSAUserNetIDException>(0L, "[DirectoryHelper::GetTenantRecipientSessionByMSAUserNetID] Caught CannotResolveMSAUserNetIDException when trying to get tenant recipient session by MSA user NetID for {0}. Exception details: {1}.", msaUserNetID, ex);
                    throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.UserNotFound, ex.Message, ex);
                }
                ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolveMSAUserNetIDException>(0L, "[DirectoryHelper::GetTenantRecipientSessionByMSAUserNetID] Caught CannotResolveMSAUserNetIDException when trying to get tenant recipient session by MSA user NetID for {0}. Exception details: {1}.", msaUserNetID, ex);
                return(null);
            }
            catch (CannotResolveExternalDirectoryOrganizationIdException ex2)
            {
                throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.DomainNotFound, ex2.Message, ex2);
            }
IL_AE:
            sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
IL_B4:
            return(DirectoryHelper.CreateSession(sessionSettings, msaUserNetID, requestForestWideDomainControllerAffinityByUserId));
        }
コード例 #7
0
        // Token: 0x060003E5 RID: 997 RVA: 0x00016B70 File Offset: 0x00014D70
        internal static IRecipientSession GetBusinessTenantRecipientSessionFromDomain(string domain, RequestDetailsLogger logger, LatencyTracker latencyTracker)
        {
            if (string.IsNullOrEmpty(domain))
            {
                throw new ArgumentNullException("domain");
            }
            ADSessionSettings sessionSettings;

            if (Utilities.IsPartnerHostedOnly || GlobalConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).WindowsLiveID.Enabled)
            {
                sessionSettings = DirectoryHelper.CreateADSessionSettingsWithDiagnostics(() => ADSessionSettings.FromBusinessTenantAcceptedDomain(domain), logger, latencyTracker, false);
            }
            else
            {
                sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            return(DirectoryHelper.CreateSession(sessionSettings));
        }
コード例 #8
0
        // Token: 0x060003E4 RID: 996 RVA: 0x00016AEC File Offset: 0x00014CEC
        internal static IRecipientSession GetRecipientSessionFromSmtpOrLiveId(string smtpOrLiveId, RequestDetailsLogger logger, LatencyTracker latencyTracker, bool ignoreCannotResolveTenantNameException = false)
        {
            if (string.IsNullOrEmpty(smtpOrLiveId))
            {
                throw new ArgumentNullException("smtpOrLiveId");
            }
            ADSessionSettings adsessionSettings = null;

            if ((Utilities.IsPartnerHostedOnly || GlobalConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).WindowsLiveID.Enabled) && SmtpAddress.IsValidSmtpAddress(smtpOrLiveId))
            {
                adsessionSettings = DirectoryHelper.CreateADSessionSettingsWithDiagnostics(() => ADSessionSettings.FromTenantRecipientSmtpAddress(new SmtpAddress(smtpOrLiveId), 2), logger, latencyTracker, ignoreCannotResolveTenantNameException);
            }
            if (adsessionSettings == null)
            {
                adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            return(DirectoryHelper.CreateSession(adsessionSettings));
        }
コード例 #9
0
        internal static IRecipientSession GetRecipientSessionFromDomain(LatencyTracker latencyTracker, string domain, bool ignoreCannotResolveTenantNameException = false)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            if (string.IsNullOrEmpty(domain))
            {
                throw new ArgumentNullException("domain");
            }
            ADSessionSettings sessionSettings = null;

            if (!Utilities.IsPartnerHostedOnly)
            {
                if (!VariantConfiguration.InvariantNoFlightingSnapshot.Global.WindowsLiveID.Enabled)
                {
                    goto IL_7F;
                }
            }
            try
            {
                sessionSettings = DirectoryHelper.CreateADSessionSettingsFromDomain(latencyTracker, domain);
                goto IL_85;
            }
            catch (CannotResolveTenantNameException ex)
            {
                ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolveTenantNameException>(0L, "[DirectoryHelper::GetRecipientSessionFromDomain] Caught CannotResolveTenantNameException when resolving tenant by domain {0}. Exception details: {1}.", domain, ex);
                if (!ignoreCannotResolveTenantNameException)
                {
                    throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.DomainNotFound, ex.Message, ex);
                }
                return(null);
            }
IL_7F:
            sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
IL_85:
            return(DirectoryHelper.CreateSession(sessionSettings));
        }
コード例 #10
0
 internal static IRecipientSession GetRootOrgRecipientSession()
 {
     return(DirectoryHelper.CreateSession(ADSessionSettings.FromRootOrgScopeSet()));
 }