コード例 #1
0
        internal override ExchangePrincipal InternalCreateExchangePrincipal()
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug <string>(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Creating scoped AD session for {0}", (base.UserOrganizationId == null) ? this.DomainName : base.UserOrganizationId.ToString());
            bool flag = HttpContext.Current != null && UserAgentUtilities.IsMonitoringRequest(HttpContext.Current.Request.UserAgent);
            ExchangePrincipal result;

            try
            {
                ADSessionSettings sessionSettings = (base.UserOrganizationId == null) ? UserContextUtilities.CreateScopedSessionSettings(this.DomainName, null) : UserContextUtilities.CreateScopedSessionSettings(null, base.UserOrganizationId);
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings, 417, "InternalCreateExchangePrincipal", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\common\\OwaClientSecurityContextIdentity.cs");
                if (flag)
                {
                    TimeSpan value = TimeSpan.FromSeconds((double)OwaClientSecurityContextIdentity.ADTimeoutForExchangePrincipalInstantiation.Value);
                    ExTraceGlobals.CoreCallTracer.TraceDebug <double>(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Reduced AD timeout to {0} seconds", value.TotalSeconds);
                    tenantOrRootOrgRecipientSession.ClientSideSearchTimeout = new TimeSpan?(value);
                }
                ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Calling ExchangePrincipal.FromUserSid");
                try
                {
                    result = ExchangePrincipal.FromUserSid(tenantOrRootOrgRecipientSession, this.UserSid);
                }
                catch (UserHasNoMailboxException ex)
                {
                    ADUser aduser = tenantOrRootOrgRecipientSession.FindBySid(this.UserSid) as ADUser;
                    ex.Data.Add("PrimarySmtpAddress", this.logonName);
                    if (aduser == null)
                    {
                        throw;
                    }
                    if (aduser.RecipientType == RecipientType.MailUser && aduser.SKUAssigned != true)
                    {
                        throw new OwaUserHasNoMailboxAndNoLicenseAssignedException(ex.Message, ex.InnerException);
                    }
                    throw;
                }
            }
            catch (Exception ex2)
            {
                OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaFailedToCreateExchangePrincipal, string.Empty, new object[]
                {
                    this.UserSid,
                    flag,
                    ex2
                });
                throw;
            }
            return(result);
        }
コード例 #2
0
        // Token: 0x060007CF RID: 1999 RVA: 0x00019A94 File Offset: 0x00017C94
        internal static IRecipientSession CreateScopedRecipientSession(bool readOnly, ConsistencyMode consistencyMode, string domain, OrganizationId orgId)
        {
            ADSessionSettings sessionSettings = UserContextUtilities.CreateScopedSessionSettings(domain, orgId);

            return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, null, CultureInfo.InvariantCulture.LCID, readOnly, consistencyMode, null, sessionSettings, 350, "CreateScopedRecipientSession", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\common\\UserContextUtilities.cs"));
        }