// Token: 0x06000366 RID: 870 RVA: 0x0000D530 File Offset: 0x0000B730 public T GetData(AuthZClientInfo effectiveCaller) { if (this.data != null) { return(this.data); } try { if (!this.isMonitoringRequest) { this.InvokeBposShellService(effectiveCaller); } } finally { if (this.data == null) { T cachedAssets = this.GetCachedAssets(); if (cachedAssets != null) { this.data = cachedAssets; } } } return(this.data); }
// Token: 0x06000369 RID: 873 RVA: 0x0000D608 File Offset: 0x0000B808 private void InvokeBposShellService(AuthZClientInfo effectiveCaller) { string text = string.Empty; try { using (ShellServiceClient shellServiceClient = new ShellServiceClient("MsOnlineShellService_EndPointConfiguration")) { string certificateThumbprint = ConfigurationManager.AppSettings["MsOnlineShellService_CertThumbprint"]; shellServiceClient.ClientCredentials.ClientCertificate.Certificate = TlsCertificateInfo.FindCertByThumbprint(certificateThumbprint); EndpointAddress address = shellServiceClient.Endpoint.Address; Uri uri = new Uri(address.Uri.AbsoluteUri); shellServiceClient.Endpoint.Address = new EndpointAddress(uri, address.Identity, new AddressHeader[0]); string text2 = HttpContext.Current.Request.Headers["RPSOrgIdPUID"]; this.userPuid = (string.IsNullOrEmpty(text2) ? HttpContext.Current.Request.Headers["RPSPUID"] : text2); this.boxServiceUrl = shellServiceClient.Endpoint.Address.Uri.AbsoluteUri; text = Guid.NewGuid().ToString(); OwaApplication.GetRequestDetailsLogger.ActivityScope.SetProperty(BposAssetReader <T> .LogMetadata.ShellRequestInfo, string.Format("OP:{0},UP:{1},UPN:{2},G:{3}", new object[] { text2, this.userPuid, this.userPrincipalName, text })); this.data = this.ExecuteRequest(shellServiceClient, this.culture.Name, this.userPrincipalName, this.userPuid, effectiveCaller, text); this.LogWorkloadLinks(this.data); } } catch (Exception e) { this.data = default(T); this.LogExceptionFromBposShellService(e, text); } }
// Token: 0x06000677 RID: 1655 RVA: 0x000137A0 File Offset: 0x000119A0 internal static OwaIdentity CreateFromAuthZClientInfo(AuthZClientInfo authZClientInfo) { if (authZClientInfo == null) { throw new ArgumentNullException("authZClientInfo", "You must specify the source AuthZClientInfo."); } OwaIdentity owaIdentity = OwaClientSecurityContextIdentity.CreateFromClientSecurityContext(authZClientInfo.ClientSecurityContext, authZClientInfo.PrimarySmtpAddress, "OverrideClientSecurityContext"); if (owaIdentity == null) { ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::CreateFromAuthZClientInfo] - was unable to create the security context for " + authZClientInfo.PrimarySmtpAddress); throw new OwaIdentityException("Cannot create security context for the specified identity. Failed to resolve the identity " + authZClientInfo.PrimarySmtpAddress); } if (authZClientInfo.SecondaryClientInfoItems.Count > 0) { OwaIdentity[] array = new OwaIdentity[authZClientInfo.SecondaryClientInfoItems.Count]; int num = 0; foreach (AuthZClientInfo authZClientInfo2 in authZClientInfo.SecondaryClientInfoItems) { array[num] = OwaClientSecurityContextIdentity.CreateFromClientSecurityContext(authZClientInfo2.ClientSecurityContext, authZClientInfo2.PrimarySmtpAddress, "OverrideClientSecurityContext"); if (array[num] == null) { ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::CreateFromAuthZClientInfo] - was unable to create the security context for composite identity. Failed to resolve secondary identity " + authZClientInfo2.PrimarySmtpAddress); throw new OwaIdentityException(string.Format("Cannot create security context for the specified composite identity. Failed to resolve the secondary identity {0}: {1}.", num, authZClientInfo2.PrimarySmtpAddress)); } num++; } owaIdentity = new OwaCompositeIdentity(owaIdentity, array); } return(owaIdentity); }
// Token: 0x0600036E RID: 878 RVA: 0x0000D874 File Offset: 0x0000BA74 protected void UpdateAppsLinks(NavBarData navBarData, AuthZClientInfo effectiveCaller) { string domain = string.Empty; if (navBarData.AppsLinks == null) { return; } if (effectiveCaller != null && !string.IsNullOrWhiteSpace(effectiveCaller.PrimarySmtpAddress)) { SmtpAddress smtpAddress = new SmtpAddress(effectiveCaller.PrimarySmtpAddress); if (smtpAddress.IsValidAddress) { domain = smtpAddress.Domain; } } string deploymentId = ExtensionDataHelper.GetDeploymentId(domain); List <NavBarLinkData> list = new List <NavBarLinkData>(navBarData.AppsLinks.Length); NavBarLinkData[] appsLinks = navBarData.AppsLinks; int i = 0; while (i < appsLinks.Length) { NavBarLinkData navBarLinkData = appsLinks[i]; if ("ShellMarketplace".Equals(navBarLinkData.Id, StringComparison.Ordinal)) { if (Globals.IsPreCheckinApp) { navBarLinkData.Url = ExtensionData.GetClientExtensionMarketplaceUrl(this.culture.LCID, HttpContext.Current.Request, false, deploymentId, null); navBarLinkData.TargetWindow = "_blank"; goto IL_169; } ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangeRunspaceConfigurationCache.Singleton.Get(effectiveCaller, null, false); if (exchangeRunspaceConfiguration.HasRoleOfType(RoleType.MyMarketplaceApps) && (string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["OfficeStoreUnavailable"]) || StringComparer.OrdinalIgnoreCase.Equals("false", ConfigurationManager.AppSettings["OfficeStoreUnavailable"]))) { navBarLinkData.Url = ExtensionData.GetClientExtensionMarketplaceUrl(this.culture.LCID, HttpContext.Current.Request, exchangeRunspaceConfiguration.HasRoleOfType(RoleType.MyReadWriteMailboxApps), deploymentId, null); navBarLinkData.TargetWindow = "_blank"; goto IL_169; } } else { if ("ShellOfficeDotCom".Equals(navBarLinkData.Id, StringComparison.Ordinal)) { navBarLinkData.TargetWindow = "_blank"; goto IL_169; } goto IL_169; } IL_171: i++; continue; IL_169: list.Add(navBarLinkData); goto IL_171; } navBarData.AppsLinks = list.ToArray(); }
// Token: 0x060019F9 RID: 6649 RVA: 0x0005DBD8 File Offset: 0x0005BDD8 protected override NavBarData InternalExecute() { AuthZClientInfo effectiveCaller = CallContext.Current.EffectiveCaller; UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, effectiveCaller, true); if (!userContext.IsBposUser) { return(null); } BposNavBarInfoAssetReader bposNavBarInfoAssetReader = userContext.BposNavBarInfoAssetReader; return(bposNavBarInfoAssetReader.GetData(effectiveCaller).NavBarData); }
internal static UserContext GetUserContext(HttpContext httpContext, AuthZClientInfo effectiveCaller = null, bool create = true) { IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(httpContext, effectiveCaller, create); if (mailboxContext == null) { return(null); } UserContext userContext = mailboxContext as UserContext; if (userContext == null) { throw new OwaInvalidOperationException("Invalid user context returned. It was expected to be a full user context."); } return(userContext); }
internal static IMailboxContext GetMailboxContext(HttpContext httpContext, AuthZClientInfo effectiveCaller = null, bool create = true) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } ClientSecurityContext overrideClientSecurityContext = (effectiveCaller == null) ? null : effectiveCaller.ClientSecurityContext; UserContextCookie userContextCookie; UserContextKey userContextKey = UserContextManager.GetUserContextKey(httpContext, overrideClientSecurityContext, out userContextCookie); if (!create) { return(UserContextManager.GetMailboxContextFromCache(userContextKey)); } return(UserContextManager.AcquireUserContext(httpContext, effectiveCaller, userContextKey, userContextCookie)); }
private BposNavBarInfo CreateBposNavBarInfo(NavBarInfo info, AuthZClientInfo effectiveCaller) { if (info == null) { return(null); } try { if (base.ShouldUpdateCache(info.Version)) { NavBarData navBarData = base.CreateNavBarData(info.NavBarDataJson); base.UpdateCachedAssets(new BposNavBarInfo(info.Version, navBarData)); } } catch (Exception) { } NavBarData navBarData2 = base.CreateNavBarData(info.NavBarDataJson); base.UpdateAppsLinks(navBarData2, effectiveCaller); return(new BposNavBarInfo(info.Version, navBarData2)); }
internal static OwaIdentity ResolveLogonIdentity(HttpContext httpContext, AuthZClientInfo effectiveCaller) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } OwaIdentity owaIdentity; if (effectiveCaller != null && effectiveCaller.ClientSecurityContext != null) { ExTraceGlobals.CoreCallTracer.TraceDebug <string>(0L, "[OwaIdentity::ResolveLogonIdentity] - Taking identity from overrideClientSecurityContext. User: {0}.", effectiveCaller.PrimarySmtpAddress); owaIdentity = OwaCompositeIdentity.CreateFromAuthZClientInfo(effectiveCaller); } else { ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Looking for identity on httpContext."); IIdentity userIdentity = CompositeIdentityBuilder.GetUserIdentity(httpContext); if (userIdentity == null) { ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::ResolveLogonIdentity] - httpContext was passed without an identity"); throw new OwaIdentityException("The httpContext must have an identity associated with it."); } owaIdentity = OwaIdentity.GetOwaIdentity(userIdentity); } if (owaIdentity != null) { string logonName = owaIdentity.GetLogonName(); ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] Successfully resolved logon identity. Type={0}, AuthType={1}, Name={2}, IsPartial={3}", new object[] { owaIdentity.GetType(), owaIdentity.AuthenticationType ?? string.Empty, logonName ?? string.Empty, owaIdentity.IsPartial }); return(owaIdentity); } ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::ResolveLogonIdentity] - was unable to create the security context."); throw new OwaIdentityException("Cannot create security context for the specified identity."); }
private BposShellInfo CreateBposShellInfo(ShellInfo info, AuthZClientInfo effectiveCaller) { if (info == null) { return(null); } try { if (base.ShouldUpdateCache(info.Version)) { NavBarData data = base.CreateNavBarData(info.NavBarDataJson); base.UpdateCachedAssets(new BposShellInfo(info.Version, data, info.SuiteServiceProxyOriginAllowedList, info.SuiteServiceProxyScriptUrl)); } } catch (Exception) { } NavBarData navBarData = base.CreateNavBarData(info.NavBarDataJson); base.UpdateAppsLinks(navBarData, effectiveCaller); return(new BposShellInfo(info.Version, navBarData, info.SuiteServiceProxyOriginAllowedList, info.SuiteServiceProxyScriptUrl)); }
private static IMailboxContext AcquireUserContext(HttpContext httpContext, AuthZClientInfo effectiveCaller, UserContextKey userContextKey, UserContextCookie userContextCookie) { IMailboxContext mailboxContext = null; UserContextStatistics userContextStatistics = null; try { if (userContextKey != null) { mailboxContext = UserContextManager.GetMailboxContextFromCache(userContextKey); if (mailboxContext == null || mailboxContext.State == UserContextState.Abandoned) { UserContextManager.CreateUserContext(httpContext, userContextKey, effectiveCaller, out mailboxContext, out userContextStatistics); } } else { UserContextManager.CreateUserContext(httpContext, null, effectiveCaller, out mailboxContext, out userContextStatistics); string cookieId = null; if (mailboxContext != null) { userContextCookie = UserContextCookie.CreateFromKey(cookieId, mailboxContext.Key, httpContext.Request.IsSecureConnection); httpContext.Response.Cookies.Set(userContextCookie.HttpCookie); userContextStatistics.CookieCreated = true; } } } finally { if (userContextStatistics != null) { SignInLogEvent logEvent = new SignInLogEvent(mailboxContext, (userContextCookie != null) ? userContextCookie.CookieValue : string.Empty, userContextStatistics, httpContext.Request.Url); OwaServerLogger.AppendToLog(logEvent); } } return(mailboxContext); }
// Token: 0x0600036A RID: 874 protected abstract T ExecuteRequest(ShellServiceClient client, string cultureName, string userPrincipalName, string userPuid, AuthZClientInfo effectiveCaller, string trackingGuid);
protected override BposNavBarInfo ExecuteRequest(ShellServiceClient client, string cultureName, string userPrincipalName, string userPuid, AuthZClientInfo effectiveCaller, string trackingGuid) { NavBarInfoRequest navBarInfoRequest = new NavBarInfoRequest { BrandId = null, CultureName = cultureName, CurrentMainLinkID = NavBarMainLinkID.Outlook, UserPrincipalName = userPrincipalName, UserPuid = userPuid, WorkloadId = WorkloadAuthenticationId.Exchange, TrackingGuid = trackingGuid }; NavBarInfo navBarInfo = client.GetNavBarInfo(navBarInfoRequest); return(this.CreateBposNavBarInfo(navBarInfo, effectiveCaller)); }
private static void CreateUserContext(HttpContext httpContext, UserContextKey userContextKey, AuthZClientInfo effectiveCaller, out IMailboxContext userContext, out UserContextStatistics userContextStats) { Stopwatch stopwatch = Stopwatch.StartNew(); userContextStats = new UserContextStatistics(); userContext = null; OwaIdentity owaIdentity = null; OwaIdentity owaIdentity2 = null; OwaIdentity owaIdentity3 = null; try { try { OwaIdentity owaIdentity4 = OwaIdentity.ResolveLogonIdentity(httpContext, effectiveCaller); owaIdentity2 = owaIdentity4; string explicitLogonUser = UserContextUtilities.GetExplicitLogonUser(httpContext); if (!string.IsNullOrEmpty(explicitLogonUser)) { ExTraceGlobals.UserContextTracer.TraceDebug <string>(0L, "Created partial mailbox identity from SMTP address={0}", explicitLogonUser); owaIdentity = OwaIdentity.CreateOwaIdentityFromExplicitLogonAddress(explicitLogonUser); owaIdentity3 = owaIdentity; } if (userContextKey == null) { userContextKey = UserContextKey.CreateNew(owaIdentity4, owaIdentity, httpContext); ExTraceGlobals.UserContextTracer.TraceDebug <UserContextKey>(0L, "Creating new user context key: {0}", userContextKey); } else { ExTraceGlobals.UserContextTracer.TraceDebug <UserContextKey>(0L, "Reusing user context key: {0}", userContextKey); } OwaRWLockWrapper userContextKeyLock = UserContextManager.GetUserContextKeyLock(userContextKey.ToString()); if (userContextKeyLock == null) { userContextStats.Error = UserContextCreationError.UnableToAcquireOwaRWLock; throw new OwaLockException("UserContextManger::CreateUserContext was not able to create a lock"); } if (userContextKeyLock.LockWriterElastic(6000)) { try { userContext = UserContextManager.GetMailboxContextFromCache(userContextKey, false); if (userContext != null && userContext.TerminationStatus == UserContextTerminationStatus.TerminatePending) { UserContextManager.TerminateSession(userContext, userContext.AbandonedReason); userContext = null; } if (userContext == null) { userContextStats.Created = true; ExTraceGlobals.UserContextTracer.TraceDebug <UserContextKey>(0L, "User context was not found in the cache, creating one. UserContextKey: {0}", userContextKey); bool flag = false; try { if (UserContextManager.IsSharedContextKey(userContextKey)) { userContext = new SharedContext(userContextKey, httpContext.Request.UserAgent); } else { userContext = new UserContext(userContextKey, httpContext.Request.UserAgent); } Stopwatch stopwatch2 = Stopwatch.StartNew(); userContext.Load(owaIdentity4, owaIdentity, userContextStats); userContextStats.LoadTime = (int)stopwatch2.ElapsedMilliseconds; UserContextManager.InsertIntoCache(httpContext, userContext); owaIdentity2 = null; owaIdentity3 = null; string userName = userContext.LogonIdentity.UserSid.ToString(); PerformanceCounterManager.UpdatePerfCounteronUserContextCreation(userName, false, false, Globals.ArePerfCountersEnabled); flag = true; } finally { if (!flag) { ExTraceGlobals.UserContextTracer.TraceDebug <UserContextKey>(0L, "User context creation failed. UserContextKey: {0}", userContextKey); if (userContext != null) { ExTraceGlobals.UserContextTracer.TraceDebug <UserContextKey>(0L, "Disposing user context. UserContextKey: {0}", userContextKey); userContext.Dispose(); userContext.State = UserContextState.Abandoned; } } } } goto IL_1EA; } finally { userContextKeyLock.ReleaseWriterLock(); } goto IL_1D4; IL_1EA: goto IL_237; } IL_1D4: userContextStats.Error = UserContextCreationError.UnableToAcquireOwaRWLock; throw new OwaLockTimeoutException("UserContextManger::CreateUserContext was not able to acquire a rw lock", null, null); } catch (OwaIdentityException ex) { userContextStats.Error = UserContextCreationError.UnableToResolveLogonIdentity; OwaServerTraceLogger.AppendToLog(new TraceLogEvent("UserContext", userContext, "UserContextManager.CreateUserContext", ex.ToString())); throw; } catch (Exception ex2) { OwaServerTraceLogger.AppendToLog(new TraceLogEvent("UserContext", userContext, "UserContextManager.CreateUserContext", ex2.ToString())); throw; } IL_237 :; } finally { if (owaIdentity2 != null) { owaIdentity2.Dispose(); } if (owaIdentity3 != null) { owaIdentity3.Dispose(); } stopwatch.Stop(); userContextStats.AcquireLatency = (int)stopwatch.ElapsedMilliseconds; httpContext.Items["UserContextStatistics"] = userContextStats; } }
protected override BposShellInfo ExecuteRequest(ShellServiceClient client, string cultureName, string userPrincipalName, string userPuid, AuthZClientInfo effectiveCaller, string trackingGuid) { ShellBaseFlight value = ShellBaseFlight.V15Parity; if (this.currentHeaderFlight == BposHeaderFlight.E16Gemini1) { value = ShellBaseFlight.V16; } else if (this.currentHeaderFlight == BposHeaderFlight.E16Gemini2) { value = ShellBaseFlight.V16G2; } ShellInfoRequest shellInfoRequest = new ShellInfoRequest { BrandId = null, CultureName = cultureName, CurrentMainLinkID = NavBarMainLinkID.Outlook, UserPrincipalName = userPrincipalName, UserPuid = userPuid, WorkloadId = WorkloadAuthenticationId.Exchange, TrackingGuid = trackingGuid, ShellBaseFlight = new ShellBaseFlight?(value), UserThemeId = (this.isGemini ? this.userContext.Theme.FolderName : null) }; shellInfoRequest.UserThemeId = null; ShellInfo shellInfo = client.GetShellInfo(shellInfoRequest); return(this.CreateBposShellInfo(shellInfo, effectiveCaller)); }