// Token: 0x0600032C RID: 812 RVA: 0x00011758 File Offset: 0x0000F958 private static TenantPartitionCacheItem FindTenantInfoByAcceptedDomain(string acceptedDomain) { PartitionId partitionId; if (!ADSessionSettings.IsGlsDisabled) { TenantPartitionCacheItem tenantPartitionCacheItem; if (ADAccountPartitionLocator.TryLookUpAccountForest(Guid.Empty, acceptedDomain, null, out tenantPartitionCacheItem)) { return(tenantPartitionCacheItem); } } else if (ADAccountPartitionLocator.IsSingleForestTopology(out partitionId)) { ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "GLS is disabled, performing the only partition lookup for {0}", acceptedDomain); return(ADAccountPartitionLocator.SearchForTenantInfoByOrganizationName(acceptedDomain, partitionId)); } if (GlsMServDirectorySession.ShouldScanAllForests) { ADAccountPartitionLocator.LoadPartitionCacheIfNecessary(); PartitionId[] array = ADAccountPartitionLocator.allAccountPartitionIds; foreach (PartitionId partitionId2 in array) { TenantPartitionCacheItem tenantPartitionCacheItem = ADAccountPartitionLocator.SearchForTenantInfoByOrganizationName(acceptedDomain, partitionId2); if (tenantPartitionCacheItem != null) { ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, acceptedDomain, null); return(tenantPartitionCacheItem); } } } return(null); }
// Token: 0x0600031E RID: 798 RVA: 0x00010DF0 File Offset: 0x0000EFF0 public static Guid GetExternalDirectoryOrganizationIdByTenantName(string tenantName, PartitionId partitionId) { if (string.IsNullOrEmpty(tenantName)) { throw new ArgumentNullException("tenantName"); } if (partitionId == null) { throw new ArgumentNullException("partitionId"); } ADAccountPartitionLocator.LoadPartitionCacheIfNecessary(); TenantPartitionCacheItem tenantPartitionCacheItem; if (!ADAccountPartitionLocator.tenantNamePartitionCache.TryGetValue(tenantName, out tenantPartitionCacheItem)) { tenantPartitionCacheItem = ADAccountPartitionLocator.SearchForTenantInfoByOrganizationName(tenantName, partitionId); if (tenantPartitionCacheItem != null) { ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, null, null); } } if (tenantPartitionCacheItem != null) { ADAccountPartitionLocator.EnsureRegisteredAccountPartition(tenantPartitionCacheItem); return(tenantPartitionCacheItem.ExternalOrgId); } throw new CannotResolveTenantNameException(DirectoryStrings.CannotResolveTenantNameByAcceptedDomain(tenantName)); }
// Token: 0x06000320 RID: 800 RVA: 0x00010EF4 File Offset: 0x0000F0F4 public static void AddTenantDataToCache(Guid externalDirectoryOrganizationId, string resourceForestFqdn, string accountForestFqdn, string domainName, string tenantContainerCN) { Guid accountPartitionGuid; ADAccountPartitionLocator.partitionsFQDNToGuid.TryGetValue(accountForestFqdn, out accountPartitionGuid); TenantPartitionCacheItem tenantPartitionCacheItem = new TenantPartitionCacheItem(accountPartitionGuid, accountForestFqdn, resourceForestFqdn, externalDirectoryOrganizationId, tenantContainerCN, false); ADAccountPartitionLocator.EnsureRegisteredAccountPartition(tenantPartitionCacheItem); ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, domainName, null); }
// Token: 0x06000329 RID: 809 RVA: 0x00011358 File Offset: 0x0000F558 private static TenantPartitionCacheItem FindTenantInfoByExternalOrgId(Guid externalOrgId) { TenantPartitionCacheItem tenantPartitionCacheItem = null; if (externalOrgId == TemplateTenantConfiguration.TemplateTenantExternalDirectoryOrganizationIdGuid) { ExchangeConfigurationUnit localTemplateTenant = TemplateTenantConfiguration.GetLocalTemplateTenant(); if (localTemplateTenant != null) { ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "FindTenantInfoByExternalOrgId() asked for Consumer Template tenant, returning {0}", localTemplateTenant.Id.Parent.DistinguishedName); string name = localTemplateTenant.Id.Parent.Name; tenantPartitionCacheItem = new TenantPartitionCacheItem(Guid.Empty, localTemplateTenant.OrganizationId.PartitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, externalOrgId, name, false); } return(tenantPartitionCacheItem); } PartitionId partitionId; if (!ADSessionSettings.IsGlsDisabled) { if (ADAccountPartitionLocator.TryLookUpAccountForest(externalOrgId, null, null, out tenantPartitionCacheItem)) { return(tenantPartitionCacheItem); } } else if (ADAccountPartitionLocator.IsSingleForestTopology(out partitionId)) { ExTraceGlobals.GLSTracer.TraceDebug <Guid>(0L, "GLS is disabled, performing the only partition lookup for {0}", externalOrgId); return(ADAccountPartitionLocator.SearchForTenantInfoByExternalOrgId(externalOrgId, partitionId)); } if (GlsMServDirectorySession.ShouldScanAllForests) { ADAccountPartitionLocator.LoadPartitionCacheIfNecessary(); PartitionId[] array = ADAccountPartitionLocator.allAccountPartitionIds; foreach (PartitionId partitionId2 in array) { tenantPartitionCacheItem = ADAccountPartitionLocator.SearchForTenantInfoByExternalOrgId(externalOrgId, partitionId2); if (tenantPartitionCacheItem != null) { ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, null, null); return(tenantPartitionCacheItem); } } } return(null); }
// Token: 0x0600032A RID: 810 RVA: 0x00011460 File Offset: 0x0000F660 private static bool TryLookUpAccountForest(Guid externalDirectoryOrganizationId, string acceptedDomain, string msaUserNetID, out TenantPartitionCacheItem cacheItem) { cacheItem = null; Exception ex = null; if (acceptedDomain == string.Empty) { throw new ArgumentException(acceptedDomain); } if (msaUserNetID == string.Empty) { throw new ArgumentException(msaUserNetID); } try { IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(null); bool dataFromOfflineService = false; string resourceForestFqdn; string text; string tenantName; bool flag; if (acceptedDomain != null) { if (ADAccountPartitionLocator.acceptedDomainPartitionCache.TryGetValue(acceptedDomain, out cacheItem)) { ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.AcceptedDomain, true); return(true); } ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.AcceptedDomain, false); string text2; flag = globalSession.TryGetTenantForestsByDomain(acceptedDomain, out externalDirectoryOrganizationId, out resourceForestFqdn, out text, out text2, out tenantName, out dataFromOfflineService); } else if (externalDirectoryOrganizationId != Guid.Empty) { if (ADAccountPartitionLocator.externalOrgIdPartitionCache.TryGetValue(externalDirectoryOrganizationId, out cacheItem)) { ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.ExternalDirectoryObjectId, true); return(true); } ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.ExternalDirectoryObjectId, false); flag = globalSession.TryGetTenantForestsByOrgGuid(externalDirectoryOrganizationId, out resourceForestFqdn, out text, out tenantName, out dataFromOfflineService); } else { if (ADAccountPartitionLocator.msaUserNetIdPartitionCache.TryGetValue(msaUserNetID, out cacheItem)) { ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.MSAUserNetID, true); return(true); } ADProviderPerf.UpdateGlsCacheHitRatio(GlsLookupKey.MSAUserNetID, false); flag = globalSession.TryGetTenantForestsByMSAUserNetID(msaUserNetID, out externalDirectoryOrganizationId, out resourceForestFqdn, out text, out tenantName); } if (flag) { ADAccountPartitionLocator.LoadPartitionCacheIfNecessary(); Guid accountPartitionGuid; ADAccountPartitionLocator.partitionsFQDNToGuid.TryGetValue(text, out accountPartitionGuid); cacheItem = new TenantPartitionCacheItem(accountPartitionGuid, text, resourceForestFqdn, externalDirectoryOrganizationId, tenantName, dataFromOfflineService); ADAccountPartitionLocator.InsertCacheMaps(cacheItem, acceptedDomain, msaUserNetID); return(true); } } catch (MServTransientException ex2) { ex = ex2; if (!GlsMServDirectorySession.ShouldScanAllForests) { throw; } } catch (MServPermanentException ex3) { ex = ex3; if (!GlsMServDirectorySession.ShouldScanAllForests) { throw; } } catch (TransientException ex4) { ex = ex4; if (!GlsMServDirectorySession.ShouldScanAllForests) { throw; } } catch (GlsPermanentException ex5) { ex = ex5; if (!GlsMServDirectorySession.ShouldScanAllForests) { throw; } } catch (GlsTenantNotFoundException ex6) { ex = ex6; if (!GlsMServDirectorySession.ShouldScanAllForests) { throw; } } if (ex != null) { ExTraceGlobals.GLSTracer.TraceWarning <Exception>(0L, "Got exception while doing GLS lookup in ADAccountPartitionLocator, ignoring it until 2605034 is fixed {0}", ex); } return(false); }