private bool ProccessBlobRequest(HttpContextBase context, out Blob blob) { blob = (Blob)null; IContent content = ServiceLocator.Current.GetInstance <IContentRouteHelper>().Content; if (content == null || !IsRoutable(content)) { return(false); } if (!content.QueryDistinctAccess(AccessLevel.Read)) { DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()((object)this); return(true); } IContent assetOwner = ServiceLocator.Current.GetInstance <ContentAssetHelper>().GetAssetOwner(content.ContentLink); if (assetOwner != null && !assetOwner.QueryDistinctAccess(AccessLevel.Read)) { DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()((object)this); return(true); } DateTime modifiedDate = DateTime.Today; if (content is IChangeTrackable) { modifiedDate = ((IChangeTrackable)content).Changed; } this.SetCachePolicy(context, modifiedDate.ToUniversalTime()); if (this.NotModifiedHandling(context, modifiedDate)) { return(true); } blob = this.GetBlob(context); return(blob != null); }
/// <summary> /// Makes sure windows authentication stay persistent even on anonymous pages when user has been logged in /// </summary> private static void KeepUserLoggedOn(HttpContextBase httpContext) { if (!EPiServer.Security.FormsSettings.IsFormsAuthentication && EPiServer.Configuration.Settings.Instance.UIKeepUserLoggedOn) { if (HttpContext.Current.Request.Cookies["KeepLoggedOnUser"] != null) { if (!httpContext.User.Identity.IsAuthenticated) { DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()(null); } } else if (httpContext.User.Identity.IsAuthenticated) { HttpCookie keepLoggedOn = new HttpCookie("KeepLoggedOnUser", "True"); keepLoggedOn.Path = HttpContext.Current.Request.ApplicationPath; HttpContext.Current.Response.Cookies.Add(keepLoggedOn); } } }
// Note! This broke with CMS 8, but since we're not using the languageselector // from code, we just ignore it //public virtual T Get<T>(ContentReference contentLink) where T : IContentData //{ // // CMS 8 // // LoaderOptions options = new LoaderOptions(); // // options.Add(new LanguageLoaderOption() {FallbackBehaviour = LanguageBehaviour.Fallback}); // return this.Get<T>(contentLink, (LanguageSelector)LanguageSelector.AutoDetect(true)); //} public virtual T Get <T>(ContentReference contentLink) where T : IContentData { T obj = Locate.ContentRepository().Get <T>(contentLink); if ((object)obj == null) { return(default(T)); } AccessLevel access = contentLink.CompareToIgnoreWorkID(this.CurrentContentLink) ? AccessLevel.Read : AccessLevel.Read; ISecurable securable = (object)obj as ISecurable; if (securable != null && !securable.GetSecurityDescriptor().HasAccess(PrincipalInfo.CurrentPrincipal, access)) { if (PrincipalInfo.CurrentPrincipal.Identity.IsAuthenticated) { throw new AccessDeniedException(); } DefaultAccessDeniedHandler.AccessDenied((object)this); } return(obj); }