private static ADUser GetOrgMailbox(string domain) { ADSessionSettings sessionSettings = null; try { sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(domain); } catch (CannotResolveTenantNameException arg) { EncryptionConfigurationTable.Tracer.TraceInformation <CannotResolveTenantNameException>(0, 0L, "Can't resolve tenant name. Exception: {0}", arg); EncryptionConfigurationTable.logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_E4EOrganizationMailboxRetrievalFailed, domain, new object[] { "ProcessEncryptionConfiguration", domain }); return(null); } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 334, "GetOrgMailbox", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\E4E\\EncryptionConfigurationTable.cs"); List <ADUser> organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantOrRootOrgRecipientSession, OrganizationCapability.OfficeMessageEncryption); if (organizationMailboxesByCapability == null || 1 != organizationMailboxesByCapability.Count) { EncryptionConfigurationTable.Tracer.TraceInformation(0, 0L, "Org mailbox is not configured."); EncryptionConfigurationTable.logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_E4EOrganizationMailboxRetrievalFailed, domain, new object[] { "ProcessEncryptionConfiguration", domain }); return(null); } return(organizationMailboxesByCapability[0]); }
internal static ADUser ResolveCertificate(X509Identifier certificate, string orgName) { Logger.EnterFunction(ExTraceGlobals.CertAuthTracer, "ResolveCertificate"); ADSessionSettings sessionSettings = null; if (string.IsNullOrEmpty(orgName)) { sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); } else { try { sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(orgName); } catch (CannotResolveTenantNameException ex) { Logger.LogError(string.Format("Can not resolve the organization based on org name {0} provided in requesting url.", orgName), ex); Logger.LogEvent(CertificateAuthenticationModule.eventLogger, TaskEventLogConstants.Tuple_CertAuth_OrganizationNotFound, null, new object[] { ex, orgName }); Logger.ExitFunction(ExTraceGlobals.CertAuthTracer, "ResolveCertificate"); HttpLogger.SafeAppendGenericError("ResolveCertificate", ex.ToString(), false); return(null); } } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 193, "ResolveCertificate", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\CertificateAuthentication\\CertificateAuthenticationModule.cs"); ADUser result = (ADUser)tenantOrRootOrgRecipientSession.FindByCertificate(certificate); Logger.ExitFunction(ExTraceGlobals.CertAuthTracer, "ResolveCertificate"); return(result); }
internal ExchangeConfigurationUnit GetConfigurationUnit(string orgName) { if (string.IsNullOrEmpty(orgName)) { throw new ArgumentException("OrgName must contain a non-empty value", "orgName"); } ExchangeConfigurationUnit exchangeConfigurationUnit = null; try { ADSessionSettings adsessionSettings = ADSessionSettings.FromTenantCUName(orgName); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, adsessionSettings, 866, "GetConfigurationUnit", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs"); adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants; exchangeConfigurationUnit = tenantConfigurationSession.GetExchangeConfigurationUnitByName(orgName); } catch (CannotResolveTenantNameException) { } SmtpDomain smtpDomain = null; if (exchangeConfigurationUnit == null && SmtpDomain.TryParse(orgName, out smtpDomain)) { try { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(orgName); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 890, "GetConfigurationUnit", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs"); exchangeConfigurationUnit = tenantConfigurationSession.GetExchangeConfigurationUnitByNameOrAcceptedDomain(orgName); } catch (CannotResolveTenantNameException) { } } Guid externalDirectoryOrganizationId; if (exchangeConfigurationUnit == null && GuidHelper.TryParseGuid(orgName, out externalDirectoryOrganizationId)) { try { PartitionId partitionIdByExternalDirectoryOrganizationId = ADAccountPartitionLocator.GetPartitionIdByExternalDirectoryOrganizationId(externalDirectoryOrganizationId); ADSessionSettings sessionSettings2 = ADSessionSettings.FromAllTenantsPartitionId(partitionIdByExternalDirectoryOrganizationId); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings2, 911, "GetConfigurationUnit", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs"); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ExchangeConfigurationUnitSchema.ExternalDirectoryOrganizationId, externalDirectoryOrganizationId.ToString()); ExchangeConfigurationUnit[] array = tenantConfigurationSession.Find <ExchangeConfigurationUnit>(ADSession.GetConfigurationUnitsRoot(partitionIdByExternalDirectoryOrganizationId.ForestFQDN), QueryScope.SubTree, filter, null, 0); if (array.Length == 1) { exchangeConfigurationUnit = array[0]; } } catch (CannotResolveExternalDirectoryOrganizationIdException) { } } return(exchangeConfigurationUnit); }
public static OrganizationId ResolveOrganizationByRealm(string realm) { if (string.IsNullOrEmpty(realm)) { throw new ArgumentNullException("realm"); } OrganizationId result = null; if (OAuthConfigHelper.isMultiTenancyEnabled) { try { Guid externalDirectoryOrganizationId; ADSessionSettings adsessionSettings; if (Guid.TryParse(realm, out externalDirectoryOrganizationId)) { adsessionSettings = ADSessionSettings.FromExternalDirectoryOrganizationId(externalDirectoryOrganizationId); } else { SmtpDomain smtpDomain; if (!SmtpDomain.TryParse(realm, out smtpDomain)) { throw new RealmFormatInvalidException(DirectoryStrings.ErrorRealmFormatInvalid(realm)); } adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(realm); } return(adsessionSettings.CurrentOrganizationId); } catch (CannotResolveExternalDirectoryOrganizationIdException innerException) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm), innerException); } catch (CannotResolveTenantNameException innerException2) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm), innerException2); } } result = OrganizationId.ForestWideOrgId; IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 306, "ResolveOrganizationByRealm", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\OAuth\\OAuthConfigHelper.cs"); if (tenantOrTopologyConfigurationSession.GetAcceptedDomainByDomainName(realm) == null) { AuthConfig authConfig = AuthConfig.Read(tenantOrTopologyConfigurationSession); if (!realm.Equals(authConfig.Realm)) { if (OAuthConfigHelper.GetAuthServers().FirstOrDefault((AuthServer server) => realm.Equals(server.Realm, StringComparison.OrdinalIgnoreCase)) == null) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm)); } } } return(result); }
// Token: 0x0600009C RID: 156 RVA: 0x00004C50 File Offset: 0x00002E50 public static ADSessionSettings SessionSettingsFromAddress(string address) { if (Common.IsMultiTenancyEnabled && !string.IsNullOrEmpty(address) && SmtpAddress.IsValidSmtpAddress(address)) { try { return(ADSessionSettings.FromTenantAcceptedDomain(new SmtpAddress(address).Domain)); } catch (CannotResolveTenantNameException) { ExTraceGlobals.FrameworkTracer.TraceDebug <string>(0L, "CreateSessionSettingsByAddresss -- Cannot locate organization for address {0}.", address); } } return(ADSessionSettings.FromRootOrgScopeSet()); }
// Token: 0x06000B56 RID: 2902 RVA: 0x0002E044 File Offset: 0x0002C244 internal static ADUser GetOrgMailbox(string domain) { ADSessionSettings adsessionSettings = null; if (OrgExtensionTable.IsDatacenter) { if (domain == null) { return(null); } try { adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(domain); } catch (CannotResolveTenantNameException arg) { OrgExtensionTable.Tracer.TraceInformation <CannotResolveTenantNameException>(0, 0L, "Can't resolve tenant name. Exception: {0}", arg); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OrganizationMailboxRetrievalFailed, domain, new object[] { "ProcessOrgExtensions", domain }); return(null); } } if (adsessionSettings == null) { adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, adsessionSettings, 559, "GetOrgMailbox", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\extension\\OrgExtensionTable.cs"); List <ADUser> organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantOrRootOrgRecipientSession, OrganizationCapability.ClientExtensions); if (organizationMailboxesByCapability == null || 1 != organizationMailboxesByCapability.Count) { OrgExtensionTable.Tracer.TraceInformation(0, 0L, "Org mailbox is not configured."); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OrganizationMailboxRetrievalFailed, domain, new object[] { "ProcessOrgExtensions", domain }); return(null); } return(organizationMailboxesByCapability[0]); }
private DomainCacheValue QueryFromADAndAddToCache(SmtpDomainWithSubdomains smtpDomainWithSubdomains, OrganizationId orgId) { ADSessionSettings sessionSettings = null; if (Datacenter.IsMultiTenancyEnabled()) { try { if (orgId != null) { sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId); } else { sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(smtpDomainWithSubdomains.ToString()); } goto IL_51; } catch (CannotResolveTenantNameException) { sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); goto IL_51; } } sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); IL_51: IConfigurationSession configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 159, "QueryFromADAndAddToCache", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\DomainCache.cs"); DomainCacheValue domainCacheValue = null; ADNotificationAdapter.TryRunADOperation(delegate() { AcceptedDomain acceptedDomainByDomainName = configSession.GetAcceptedDomainByDomainName(smtpDomainWithSubdomains.ToString()); if (acceptedDomainByDomainName != null) { domainCacheValue = new DomainCacheValue(); domainCacheValue.OrganizationId = acceptedDomainByDomainName.OrganizationId; domainCacheValue.LiveIdInstanceType = acceptedDomainByDomainName.LiveIdInstanceType; domainCacheValue.AuthenticationType = acceptedDomainByDomainName.AuthenticationType; this.InsertLimitedSliding(acceptedDomainByDomainName.DomainName, domainCacheValue, DomainCache.slidingTimeOut.Value, DomainCache.absoluteTimeOut.Value, null); } }); return(domainCacheValue); }
// Token: 0x060007CE RID: 1998 RVA: 0x00019974 File Offset: 0x00017B74 internal static ADSessionSettings CreateScopedSessionSettings(string domainName, OrganizationId orgId) { ADSessionSettings result; if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled) { try { if (orgId != null) { result = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId); } else { if (domainName == null) { throw new ArgumentNullException("domainName"); } result = ADSessionSettings.FromTenantAcceptedDomain(domainName); } return(result); } catch (CannotResolveTenantNameException) { string arg = (domainName != null) ? domainName.ToString() : "<null>"; string arg2 = (orgId != null) ? orgId.ToString() : "<null>"; string message = string.Format("Could not resolve recipient session for domain:'{0}', organization id:'{1}'", arg, arg2); ExTraceGlobals.UserContextTracer.TraceError(0L, message); throw new OwaADObjectNotFoundException(message); } catch (DataSourceOperationException innerException) { string arg3 = (domainName != null) ? domainName.ToString() : "<null>"; string arg4 = (orgId != null) ? orgId.ToString() : "<null>"; string message2 = string.Format("DataSourceException for domain:'{0}', organization id:'{1}'", arg3, arg4); ExTraceGlobals.UserContextTracer.TraceError(0L, message2); throw new OwaADObjectNotFoundException(message2, innerException); } } result = ADSessionSettings.FromRootOrgScopeSet(); return(result); }
private IRecipientSession GetRecipientSessionForDomain(string domain) { IRecipientSession result = null; ADSessionSettings adsessionSettings = null; if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && SmtpAddress.IsValidDomain(domain)) { try { adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(domain); } catch (CannotResolveTenantNameException) { TraceWrapper.SearchLibraryTracer.TraceDebug <string>(this.GetHashCode(), "Failed to resolve domain {0}.", domain); adsessionSettings = null; } } if (adsessionSettings != null) { result = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, adsessionSettings, 137, "GetRecipientSessionForDomain", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\MessageTracking\\Caching\\DomainOrgMailboxCache.cs"); } return(result); }
private DomainProperties QueryFromAD(SmtpDomainWithSubdomains smtpDomainWithSubdomains) { ADSessionSettings adsessionSettings = null; if (Datacenter.IsMultiTenancyEnabled()) { try { adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(smtpDomainWithSubdomains.ToString()); goto IL_5C; } catch (CannotResolveTenantNameException arg) { DomainPropertyCache.Tracer.TraceError <SmtpDomainWithSubdomains, CannotResolveTenantNameException>((long)this.GetHashCode(), "Failed to resolve tenant with domain {0}. Error: {1}", smtpDomainWithSubdomains, arg); adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); goto IL_5C; } } adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); IL_5C: DomainPropertyCache.Tracer.TraceDebug <SmtpDomainWithSubdomains, OrganizationId>((long)this.GetHashCode(), "The OrganizationId for domain {0} is {1}.", smtpDomainWithSubdomains, adsessionSettings.CurrentOrganizationId); IConfigurationSession configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, adsessionSettings, 219, "QueryFromAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\DomainPropertyCache.cs"); DomainProperties domainProperty = null; ADNotificationAdapter.TryRunADOperation(delegate() { AcceptedDomain acceptedDomainByDomainName = configSession.GetAcceptedDomainByDomainName(smtpDomainWithSubdomains.ToString()); if (acceptedDomainByDomainName != null) { domainProperty = new DomainProperties(smtpDomainWithSubdomains.SmtpDomain); domainProperty.OrganizationId = acceptedDomainByDomainName.OrganizationId; domainProperty.LiveIdInstanceType = acceptedDomainByDomainName.LiveIdInstanceType; DomainPropertyCache.Tracer.TraceDebug <AcceptedDomain, OrganizationId>((long)this.GetHashCode(), "Accepted domain {0} in organization {1}", acceptedDomainByDomainName, acceptedDomainByDomainName.OrganizationId); } }); return(domainProperty); }
// Token: 0x06000A7F RID: 2687 RVA: 0x00029178 File Offset: 0x00027378 private static ADSessionSettings CreateRootOrgOrSingleTenantFromAcceptedDomainAutoDetect(string domain) { ADSessionSettings result = null; try { if (Globals.IsDatacenter) { if (!string.IsNullOrWhiteSpace(domain)) { result = ADSessionSettings.FromTenantAcceptedDomain(domain); } } else { result = ADSessionSettings.FromRootOrgScopeSet(); } } catch (CannotResolveTenantNameException ex) { ExtensionDataHelper.Tracer.TraceError <string>(0L, "Failed to resolve tenant name based on provided domain", ex.Message); } return(result); }
private static ADRecipient GetADRecipientBySmtpAddress(SmtpAddress smtpAddress) { try { IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, ADSessionSettings.FromTenantAcceptedDomain(smtpAddress.Domain), 802, "GetADRecipientBySmtpAddress", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\JournalRule\\JournalRuleObject.cs"); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.PrimarySmtpAddress, smtpAddress.ToString()); ADRecipient[] array = tenantOrRootOrgRecipientSession.Find <ADRecipient>(null, QueryScope.SubTree, filter, null, 1); if (array != null && array.Length > 0) { return(array[0]); } } catch (CannotResolveTenantNameException) { } return(null); }
internal static List <string> ValidateAddresses(IRecipientSession recipientSession, ADObjectId executingUserId, MultiValuedProperty <string> notificationEmailAddresses, out IList <LocalizedString> localizedWarnings) { if (recipientSession == null) { throw new ArgumentNullException("recipientSession"); } List <string> list = new List <string>(((notificationEmailAddresses != null) ? notificationEmailAddresses.Count : 0) + 1); localizedWarnings = new List <LocalizedString>(list.Count); if (executingUserId != null) { ADRecipient adrecipient = recipientSession.Read(executingUserId); if (adrecipient == null || !MobileDeviceTaskHelper.IsUserMailboxEnabled(adrecipient)) { localizedWarnings.Add(Strings.LogonUserIsNotAValidADRecipient(executingUserId.ToString())); } else { list.Add(adrecipient.PrimarySmtpAddress.ToString()); } } if (notificationEmailAddresses != null) { foreach (string text in notificationEmailAddresses) { if (!SmtpAddress.IsValidSmtpAddress(text)) { ADRecipient[] array = recipientSession.FindByANR(text, 2, null); if (array == null || array.Length != 1 || !MobileDeviceTaskHelper.IsUserMailboxEnabled(array[0])) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); } else { list.Add(array[0].PrimarySmtpAddress.ToString()); } } else { IRecipientSession recipientSession2 = recipientSession; if (GlobalSettings.IsMultiTenancyEnabled) { try { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(SmtpAddress.Parse(text).Domain); recipientSession2 = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 240, "ValidateAddresses", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AirSync\\MobileDeviceTaskHelper.cs"); } catch (CannotResolveTenantNameException) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); recipientSession2 = null; } } if (recipientSession2 != null) { ADRecipient adrecipient2 = recipientSession2.FindByProxyAddress(ProxyAddress.Parse(text)); if (adrecipient2 == null) { localizedWarnings.Add(Strings.InvalidSmtpAddressOrAlias(text)); } else { list.Add(adrecipient2.PrimarySmtpAddress.ToString()); } } } } } return(list); }
public static OAuthCredentials Create(InternalClientContext clientContext, RequestLogger requestLogger) { ArgumentValidator.ThrowIfNull("clientContext", clientContext); OrganizationId organizationId = clientContext.OrganizationId; ADUser aduser = clientContext.ADUser; string text = FaultInjection.TraceTest <string>((FaultInjection.LIDs) 2743479613U); if (!string.IsNullOrEmpty(text)) { SmtpAddress smtpAddress = SmtpAddress.Parse(text); IRecipientSession recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromTenantAcceptedDomain(smtpAddress.Domain), 68, "Create", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\RequestDispatch\\OAuthCredentialsFactory.cs"); aduser = (recipientSession.FindByProxyAddress(ProxyAddress.Parse(text)) as ADUser); organizationId = aduser.OrganizationId; } OAuthCredentials oauthCredentialsForAppActAsToken = OAuthCredentials.GetOAuthCredentialsForAppActAsToken(organizationId, aduser, null); OAuthCredentialsFactory.SetCredentialsProperties(oauthCredentialsForAppActAsToken, clientContext, requestLogger); return(oauthCredentialsForAppActAsToken); }
internal static IConfigurationSession GetConfigurationSessionFromDomain(string domain) { return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, string.IsNullOrEmpty(domain) ? ADSessionSettings.FromRootOrgScopeSet() : ADSessionSettings.FromTenantAcceptedDomain(domain), 489, "GetConfigurationSessionFromDomain", "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\Misc\\DirectoryHelper.cs")); }
private static ADSessionSettings CreateADSessionSettingsFromDomain(LatencyTracker latencyTracker, string domain) { return(DirectoryHelper.ExecuteFunctionAndUpdateMovingAveragePerformanceCounter <ADSessionSettings>(PerfCounters.HttpProxyCountersInstance.MovingAverageTenantLookupLatency, () => DirectoryHelper.InvokeGls <ADSessionSettings>(latencyTracker, () => ADSessionSettings.FromTenantAcceptedDomain(domain)))); }
// Token: 0x0600003C RID: 60 RVA: 0x00003964 File Offset: 0x00001B64 internal static ExchangeConfigurationUnit ResolveConfigurationUnitByName(string domainName) { ITenantConfigurationSession session = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromTenantAcceptedDomain(domainName), 454, "ResolveConfigurationUnitByName", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\RedirectionModule\\RedirectionHelper.cs"); return(RedirectionHelper.ResolveConfigurationUnitByName(domainName, session)); }
internal static IRecipientSession GetRecipientSession(string domain) { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(domain); return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantLocal, 806, "GetRecipientSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\Authentication\\TestLiveIdAuthenticationTask.cs")); }
// Token: 0x06000FB5 RID: 4021 RVA: 0x00040414 File Offset: 0x0003E614 public IEnumerable <ConnectionSettings> GetConnectionSettingsMatchingEmail(SmtpAddress email) { Office365ConnectionSettings connectionSettings = null; this.log.ExecuteMonitoredOperation(ConnectionSettingsDiscoveryMetadata.GetOffice365ConnectionSettings, delegate { try { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(email.Domain); ITenantRecipientSession recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 78, "GetConnectionSettingsMatchingEmail", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\ConnectionSettingsDiscovery\\ConnectionSettingsProviders\\O365ConnectionSettingsProvider.cs"); MiniRecipient adUser = null; Action action = delegate() { adUser = recipientSession.FindByProxyAddress <MiniRecipient>(new SmtpProxyAddress(email.ToString(), true)); }; bool flag = false; int i = 0; while (i < 1) { i++; try { action(); flag = true; break; } catch (DataSourceTransientException ex) { this.log.Trace("Caught an exception from directory while trying to find an AD user object for email address {0}. Exception: {1}", new object[] { email, ex }); } catch (DataSourceOperationException ex2) { this.log.Trace("Caught an exception from directory while trying to find an AD user object for email address {0}. Exception: {1}", new object[] { email, ex2 }); } } if (!flag) { i++; action(); } if (adUser != null) { connectionSettings = new Office365ConnectionSettings(adUser); } else { this.log.Trace("Found Office365 connection settings for email address {0} when AD user object does not exist", new object[] { email }); connectionSettings = new Office365ConnectionSettings(); } } catch (CannotResolveTenantNameException exception) { this.log.LogException(exception, "Failed to find Office365 connection settings for email address {0}. No tenant exists with domain name: ", new object[] { email, email.Domain }); } }); if (connectionSettings != null) { this.log.LogOperationResult(ConnectionSettingsDiscoveryMetadata.Office365ConnectionSettingsFound, email.Domain, true); yield return(new ConnectionSettings(this, connectionSettings, null)); } this.log.LogOperationResult(ConnectionSettingsDiscoveryMetadata.Office365ConnectionSettingsFound, email.Domain, false); yield break; }