public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { if (lifecycleEvent == LifecycleEvent.BeginRequest || lifecycleEvent == LifecycleEvent.Handler) return true; return context.GetGlimpseMode() != GlimpseMode.Off; }
public ContentTypeValidator(GlimpseConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); Configuration = configuration; }
public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { if (lifecycleEvent == LifecycleEvent.BeginRequest || lifecycleEvent == LifecycleEvent.Handler) return true; return !(context.Handler is Handler); }
public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { if (configuration.IpAddresses.Count == 0) return true; //no configured list, allow all IP's var userIpAddress = GetUserIpAddress(context, configuration.IpForwardingEnabled); return configuration.IpAddresses.Contains(userIpAddress); }
public IpAddressValidator(GlimpseConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); Configuration = configuration; IpFilters = BuildFilters(Configuration).ToList(); }
void InitiateGlimpse() { var glimpseConfiguration = new GlimpseConfiguration(); glimpseConfiguration.Enabled = true; glimpseConfiguration.IpAddresses.Add(new IpAddress {Address = "127.0.0.1"}); glimpseConfiguration.IpAddresses.Add(new IpAddress {Address = "::1"}); glimpseConfiguration.ContentTypes.Add(new ContentType() {Content = "text/html"}); glimpseConfiguration.ContentTypes.Add(new ContentType() {Content = "application/json"}); if (LocalIp != null) glimpseConfiguration.IpAddresses.Add(new IpAddress {Address = LocalIp}); Glimpse.Core.Module.Configuration = glimpseConfiguration; Glimpse.Core.Module.ConstructDependencies(); }
public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { if (configuration.UrlBlackList.Count == 0) return true; //no configured list, allow all URL's foreach (GlimpseUrl url in configuration.UrlBlackList) { if (Regex.IsMatch(context.Request.CurrentExecutionFilePath,url.Url,RegexOptions.IgnoreCase)) { return false; } } // if nothing matched, the URL is allowed return true; }
public static IEnumerable<IIpFilter> BuildFilters(GlimpseConfiguration configuration) { var filters = configuration.IpAddresses.Cast<IpAddress>() .OrderBy(i => i.Address == null ? 1 : 0).ToList(); //Order so address are validated against before ranges foreach (var filter in filters) { if ((filter.Address == null && filter.AddressRange == null) || (filter.Address != null && filter.AddressRange != null)) throw new ConfigurationErrorsException("IpAddress element must have either an address or an address-range attribute"); if (filter.Address != null) yield return new IpFilter(IPAddress.Parse(filter.Address)); else yield return new IpRangeFilter(filter.AddressRange); } }
public Environment(GlimpseConfiguration configuration) { Configuration = configuration; }
public InProcStackMetadataStore(GlimpseConfiguration configuration, HttpApplicationStateBase applicationState) { Configuration = configuration; ApplicationState = applicationState; }
public Config(GlimpseConfiguration configuration) { Configuration = configuration; }
public void Setup() { Context = new Mock<HttpContextBase>(); Configuration = new GlimpseConfiguration(); Configuration.IpAddresses.Clear(); }
public GlimpseFactory(GlimpseConfiguration configuration) { Configuration = configuration; Factory = BuildFactory(); }
public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { var validResponseCodes = new List<int> { 200, 301, 302 }; return validResponseCodes.Contains(context.Response.StatusCode); }
public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent) { if (configuration.IpAddresses.Count == 0) return true; //no configured list, allow all IP's return configuration.IpAddresses.Contains(context.Request.UserHostAddress); }