private void OnAuthenticateRequest(object sender, EventArgs e) { HttpApplication application = sender as HttpApplication; HttpContext context = HttpContext.Current; HttpRequest request = context.Request; if (DispatchBasicAuthentication(application, request)) { return; } if (request.Headers["CharlesCrawler"] == "true") { application.Context.User = new PortalPrincipal(User.Visitor); return; } string authenticationType = null; string repositoryPath = string.Empty; // Get the current PortalContext var currentPortalContext = PortalContext.Current; if (currentPortalContext != null) { authenticationType = currentPortalContext.AuthenticationMode; } // default authentication mode if (string.IsNullOrEmpty(authenticationType)) { authenticationType = WebApplication.DefaultAuthenticationMode; } // if no site auth mode, no web.config default, then exception... if (string.IsNullOrEmpty(authenticationType)) { throw new ApplicationException("The engine could not determine the authentication mode for this request. This request does not belong to a site, and there was no default authentication mode set in the web.config."); } switch (authenticationType) { case "Windows": EmulateWindowsAuthentication(application); SetApplicationUser(application, authenticationType); break; case "Forms": application.Context.User = null; CallInternalOnEnter(sender, e); SetApplicationUser(application, authenticationType); break; case "None": // "None" authentication: set the Visitor Identity application.Context.User = new PortalPrincipal(User.Visitor); break; default: Site site = null; SenseNet.ContentRepository.Storage.Node problemNode = SenseNet.ContentRepository.Storage.Node.LoadNode(repositoryPath); if (problemNode != null) { site = Site.GetSiteByNode(problemNode); if (site != null) { authenticationType = site.GetAuthenticationType(application.Context.Request.Url); } } string message = null; if (site == null) { message = string.Format(HttpContext.GetGlobalResourceObject("Portal", "DefaultAuthenticationNotSupported") as string, authenticationType); } else { message = string.Format("AuthenticationNotSupportedOnSite", site.Name, authenticationType); } throw new NotSupportedException(message); } }
void OnAuthenticateRequest(object sender, EventArgs e) { //DebugThis("begin"); HttpApplication application = sender as HttpApplication; HttpContext context = HttpContext.Current; HttpRequest request = context.Request; //trace bool traceReportEnabled; var traceQueryString = request.QueryString["trace"]; if (!String.IsNullOrEmpty(traceQueryString)) { traceReportEnabled = (traceQueryString == "true") ? true : false; } else { traceReportEnabled = RepositoryConfiguration.TraceReportEnabled; } if (traceReportEnabled) { var slot = Thread.GetNamedDataSlot(Tracing.OperationTraceDataSlotName); var data = Thread.GetData(slot); if (data == null) { Thread.SetData(slot, new OperationTraceCollector()); } } //trace if (DispatchBasicAuthentication(application, request)) { return; } if (request.Headers["CharlesCrawler"] == "true") { application.Context.User = new PortalPrincipal(User.Visitor); return; } if (DispatchUploadRequest(application, request)) { return; } string authenticationType = null; string repositoryPath = string.Empty; // Get the current PortalContext var currentPortalContext = PortalContext.Current; if (currentPortalContext != null) { authenticationType = currentPortalContext.AuthenticationMode; //install time if (string.IsNullOrEmpty(authenticationType) && currentPortalContext.Site == null) { authenticationType = "None"; } } // default authentication mode if (string.IsNullOrEmpty(authenticationType)) { authenticationType = WebConfigurationManager.AppSettings["DefaultAuthenticationMode"]; } // if no site auth mode, no web.config default, then exception... if (string.IsNullOrEmpty(authenticationType)) { throw new ApplicationException("The engine could not determine the authentication mode for this request. This request does not belong to a site, and there was no default authentication mode set in the web.config."); } switch (authenticationType) { case "Windows": EmulateWindowsAuthentication(application); SetApplicationUser(application, authenticationType); break; case "Forms": application.Context.User = null; CallInternalOnEnter(sender, e); SetApplicationUser(application, authenticationType); break; case "None": // "None" authentication: set the Visitor Identity application.Context.User = new PortalPrincipal(User.Visitor); break; default: Site site = null; SenseNet.ContentRepository.Storage.Node problemNode = SenseNet.ContentRepository.Storage.Node.LoadNode(repositoryPath); if (problemNode != null) { site = Site.GetSiteByNode(problemNode); if (site != null) { authenticationType = site.GetAuthenticationType(application.Context.Request.Url); } } string message = null; if (site == null) { message = string.Format(HttpContext.GetGlobalResourceObject("Portal", "DefaultAuthenticationNotSupported") as string, authenticationType); } else { message = string.Format("AuthenticationNotSupportedOnSite", site.Name, authenticationType); } throw new NotSupportedException(message); } //DebugThis("end"); }
public override bool IsContentSupported(STORAGE.Node content) { return(PreviewImageGenerator.IsSupportedExtension(ContentNamingProvider.GetFileExtension(content.Name))); }
public override bool IsContentSupported(STORAGE.Node content) { return(SUPPORTED_EXTENSIONS.Contains(ContentNamingHelper.GetFileExtension(content.Name).ToLower())); }