예제 #1
0
        public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent)
        {
            if (lifecycleEvent == LifecycleEvent.BeginRequest || lifecycleEvent == LifecycleEvent.Handler)
                return true;

            return context.GetGlimpseMode() != GlimpseMode.Off;
        }
예제 #2
0
        public ContentTypeValidator(GlimpseConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            Configuration = configuration;
        }
예제 #3
0
        public bool IsValid(HttpContextBase context, GlimpseConfiguration configuration, LifecycleEvent lifecycleEvent)
        {
            if (lifecycleEvent == LifecycleEvent.BeginRequest || lifecycleEvent == LifecycleEvent.Handler)
                return true;

            return !(context.Handler is Handler);
        }
예제 #4
0
        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);
        }
예제 #5
0
        public IpAddressValidator(GlimpseConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            Configuration = configuration;

            IpFilters = BuildFilters(Configuration).ToList();
        }
예제 #6
0
        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();
        }
예제 #7
0
        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;
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
 public Environment(GlimpseConfiguration configuration)
 {
     Configuration = configuration;
 }
 public InProcStackMetadataStore(GlimpseConfiguration configuration, HttpApplicationStateBase applicationState)
 {
     Configuration = configuration;
     ApplicationState = applicationState;
 }
예제 #11
0
 public Config(GlimpseConfiguration configuration)
 {
     Configuration = configuration;
 }
예제 #12
0
 public void Setup()
 {
     Context = new Mock<HttpContextBase>();
     Configuration = new GlimpseConfiguration();
     Configuration.IpAddresses.Clear();
 }
예제 #13
0
 public GlimpseFactory(GlimpseConfiguration configuration)
 {
     Configuration = configuration;
     Factory = BuildFactory();
 }
예제 #14
0
 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);
        }