private void InitCredentials(BasicAuthenticationConfigurationSection basicAuth)
        {
            activeUsers = new Dictionary <string, string>();

            for (var i = 0; i < basicAuth.Credentials.Count; i++)
            {
                var credential = basicAuth.Credentials[i];
                activeUsers.Add(credential.UserName.ToLower(), credential.Password);
            }
        }
        private void InitExcludes(BasicAuthenticationConfigurationSection basicAuth)
        {
            var excludesAsString = new Dictionary <string, string>();

            excludes = new Dictionary <Regex, Regex>();
            var allowAnyRegex = AllowAnyRegex.ToString();

            for (var i = 0; i < basicAuth.Excludes.Count; i++)
            {
                var excludeUrl  = basicAuth.Excludes[i].Url;
                var excludeVerb = basicAuth.Excludes[i].Verb;

                if (string.IsNullOrEmpty(excludeUrl))
                {
                    excludeUrl = allowAnyRegex;
                }
                if (string.IsNullOrEmpty(excludeVerb))
                {
                    excludeVerb = allowAnyRegex;
                }

                excludesAsString[excludeUrl] = excludeVerb;
            }

            foreach (var url in excludesAsString.Keys)
            {
                var urlRegex = url == allowAnyRegex
          ? AllowAnyRegex
          : new Regex(url, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                var verbRegex = excludesAsString[url] == allowAnyRegex
          ? AllowAnyRegex
          : new Regex(excludesAsString[url], RegexOptions.Compiled | RegexOptions.IgnoreCase);

                excludes[urlRegex] = verbRegex;
            }
        }