示例#1
0
        public ClientApiKeyValidationMiddleware(RequestDelegate next, IClientApiKeyService clientApiKeyService, IOptions <ApiGatewaySettings> settings)
        {
            _next = next;
            _clientApiKeyService = clientApiKeyService;
            _settings            = settings.Value;

            if (!string.IsNullOrWhiteSpace(_settings.AllowAnonymousApiPath) && _settings.AllowAnonymousApiPath.Length > 0)
            {
                _allowAnnon = new Regex(_settings.AllowAnonymousApiPath, RegexOptions.IgnoreCase);
            }
        }
 public ReverseProxyMiddleware(RequestDelegate next,
                               ILoggerFactory loggerFactory,
                               IOptions <ApiGatewaySettings> apiGatewaySettingsOptions,
                               IHttpClientFactory httpClientFactory)
 {
     if (loggerFactory == null)
     {
         throw new ArgumentNullException(nameof(loggerFactory));
     }
     _logger   = loggerFactory.CreateLogger <ReverseProxyMiddleware>();
     _settings = apiGatewaySettingsOptions?.Value ??
                 throw new ArgumentNullException(nameof(apiGatewaySettingsOptions));
     _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
 }
示例#3
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     _settings     = Configuration.GetSection(typeof(ApiGatewaySettings).Name).Get <ApiGatewaySettings>();
 }
示例#4
0
 public ClientApiKeyService(IOptions <ApiGatewaySettings> settings, IHttpClientFactory clientFactory)
 {
     _settings      = settings.Value;
     _clientFactory = clientFactory;
 }