Beispiel #1
0
 public IPBackgroundUpdater(
     [NotNull] AllowedIPAddressHandler ipHandler,
     [NotNull] ILogger logger)
 {
     _ipHandler = ipHandler ?? throw new ArgumentNullException(nameof(ipHandler));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Beispiel #2
0
        public DefaultAuthorizationHandler(IKeyValueConfiguration keyValueConfiguration, AllowedIPAddressHandler allowedIPAddressHandler)
        {
            _allowedIPAddressHandler = allowedIPAddressHandler;

            IPAddress[] ipAddressesFromConfig = keyValueConfiguration[ConfigurationConstants.AllowedIPs]
                                                .Split(',', StringSplitOptions.RemoveEmptyEntries).Select(IPAddress.Parse).ToArray();

            _allowed = new HashSet <IPAddress> {
                IPAddress.Parse("::1"), IPAddress.Parse("127.0.0.1")
            };

            foreach (IPAddress address in ipAddressesFromConfig)
            {
                _allowed.Add(address);
            }
        }