public CensusApi(IApiKeyProvider keyService) { _apiKey = keyService.CensusApiKey; DataSet = CensusDataSet.SF1; client = new HttpClient(); client.BaseAddress = new Uri("http://api.census.gov/data/2010/"); }
public BingMapsApi(IApiKeyProvider keyService) { _bingMapsKey = keyService.BingMapsKey; client = new HttpClient(); client.BaseAddress = new Uri("http://dev.virtualearth.net/REST/v1/Locations/"); }
public PresentController(IApiKeyProvider apiKeyProvider, IShowsClient shows, ILogger <PresentController> logger, IQuestionsClient questions) { _apiKeyProvider = apiKeyProvider; _shows = shows; _logger = logger; _questions = questions; }
public static async Task <string> AddKeyToQueryStringAsync( this IApiKeyProvider apiKeyProvider, string url, CancellationToken cancellationToken) { // Validate parameters. if (apiKeyProvider == null) { throw new ArgumentNullException(nameof(apiKeyProvider)); } if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } // The key. const string name = "key"; // Get the value. string value = await apiKeyProvider .GetApiKeyAsync(cancellationToken) .ConfigureAwait(false); // Append and return. return(QueryHelpers.AddQueryString(url, name, value)); }
public MarketCandleCollector( IApiKeyProvider apiKeyProvider, MarkerAssetCandleCollector assetCollector, MarketCurrencyCandleCollector currencyCollector) { _apiKeyProvider = apiKeyProvider; _assetCollector = assetCollector; _currencyCollector = currencyCollector; }
public BearerTokenValidator(IApiKeyProvider keyProvider) { if (keyProvider == null) { throw new ArgumentNullException(nameof(keyProvider)); } _keyProvider = keyProvider; }
public MyTokenController(IApiKeyProvider keyProvider) { if (keyProvider == null) { throw new ArgumentNullException(nameof(keyProvider)); } _keyProvider = keyProvider; }
public MarketMetadataCollector( ILogger <MarketMetadataCollector> logger, IApiKeyProvider apiKeyProvider, IsinProvider isinProvider, MetadataManager metadataManager) { _logger = logger; _isinProvider = isinProvider; _apiKeyProvider = apiKeyProvider; _metadataManager = metadataManager; }
public IndexModel( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, IApiKeyProvider apiKeyProvider) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _apiKeyProvider = apiKeyProvider; }
public GoogleApiMessageHandler( IApiKeyProvider apiKeyProvider ) { // Validate parameters. _apiKeyProvider = apiKeyProvider ?? throw new ArgumentNullException(nameof(apiKeyProvider)); // Set compression. this.SetCompression(); }
protected ApiKeyRequirement(long maxValue, TimeSpan renewalPeriod, bool sliding, IApiKeyProvider apiKeyProvider) : base(maxValue, renewalPeriod, sliding) { if (apiKeyProvider == null) { throw new ArgumentNullException(nameof(apiKeyProvider)); } _apiKeyProvider = apiKeyProvider; }
// ReSharper disable once UnusedParameter.Local public SlidesMiddleware(RequestDelegate _, IOptions <StorageOptions> options, ILogger <SlidesMiddleware> logger, IApiKeyProvider apiKeyProvider) { _logger = logger; _apiKeyProvider = apiKeyProvider; var storageAccount = CloudStorageAccount.Parse(options.Value.ConnectionString); _client = storageAccount.CreateCloudBlobClient(); _putPolicy = ResiliencePolicy.Create(logger); _getPolicy = ResiliencePolicy.Create(logger); _logger.LogWarning(nameof(SlidesMiddleware)); }
public TeamsMapController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext serviceContext, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper, IApiKeyProvider apiKeyProvider) : base(globalSettings, umbracoContextAccessor, serviceContext, appCaches, profilingLogger, umbracoHelper) { _apiKeyProvider = apiKeyProvider; }
public Market(string name, IMarketModel model, IEnumerable <ApiKeyRole> apiKeyRoles, string usdCurrencyTag, TimeframeType[] possibleTimeframes) { Name = name; Model = model; UsdCurrencyTag = usdCurrencyTag; SpecifiedRoles = apiKeyRoles.ToArray(); PossibleTimeframes = possibleTimeframes; _apiKeyProvider = new ApiKeyProvider(SpecifiedRoles); UsdEquivalent = new UsdEquivalent(this); }
public SeasonMapController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext serviceContext, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper, ISeasonDataSource seasonDataSource, IApiKeyProvider apiKeyProvider) : base(globalSettings, umbracoContextAccessor, serviceContext, appCaches, profilingLogger, umbracoHelper) { _seasonDataSource = seasonDataSource ?? throw new ArgumentNullException(nameof(seasonDataSource)); _apiKeyProvider = apiKeyProvider ?? throw new ArgumentNullException(nameof(apiKeyProvider)); }
//use factory to prevent ambiguous reference to IAuthenticationHeaderProvider as each client //requires a different value for api key name, if multiple of these are reg'd could cause problems private static ReverseDnsClient ApiKeyReverseDnsClientFactory(IServiceProvider serviceProvider) { IReverseDnsClientConfig reverseDnsClientConfig = serviceProvider.GetRequiredService <IReverseDnsClientConfig>(); ILogger <ReverseDnsClient> logger = serviceProvider.GetRequiredService <ILogger <ReverseDnsClient> >(); IReverseDnsApiKeyConfig reverseDnsApiKeyConfig = serviceProvider.GetRequiredService <IReverseDnsApiKeyConfig>(); IApiKeyProvider apiKeyProvider = serviceProvider.GetRequiredService <IApiKeyProvider>(); ApiKeyAuthenticationHeaderProvider reverseDnsApiKeyAuthenticationHeaderProvider = new ApiKeyAuthenticationHeaderProvider(reverseDnsApiKeyConfig.ReverseDnsClaimsName, apiKeyProvider); return(new ReverseDnsClient(reverseDnsClientConfig, reverseDnsApiKeyAuthenticationHeaderProvider, logger)); }
public CreateMatchLocationController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext serviceContext, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper, IApiKeyProvider apiKeyProvider, IAuthorizationPolicy <MatchLocation> authorizationPolicy) : base(globalSettings, umbracoContextAccessor, serviceContext, appCaches, profilingLogger, umbracoHelper) { _apiKeyProvider = apiKeyProvider ?? throw new System.ArgumentNullException(nameof(apiKeyProvider)); _authorizationPolicy = authorizationPolicy ?? throw new System.ArgumentNullException(nameof(authorizationPolicy)); }
public SignatureServiceOptionsBuilder UseDbContext <TContext, TEntity>( Func <TContext, DbSet <TEntity> > entitySelector, Func <TEntity, string> keySelector, Func <TEntity, string> valueSelector) where TContext : DbContext where TEntity : class { var context = provider.GetService <TContext>(); //context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; var dbSet = entitySelector.Invoke(context); this.apiKeyProvider = new IDKeyDbProvider <TEntity>(dbSet, keySelector, valueSelector); return(this); }
public ManageController( UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, IEmailSender emailSender, ISmsSender smsSender, ILoggerFactory loggerFactory, IApiKeyProvider apiKeyProvider) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _smsSender = smsSender; _apiKeyProvider = apiKeyProvider; _logger = loggerFactory.CreateLogger<ManageController>(); }
public MatchLocationController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext serviceContext, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper, IMatchLocationDataSource matchLocationDataSource, IAuthorizationPolicy <MatchLocation> authorizationPolicy, IApiKeyProvider apiKeyProvider, IEmailProtector emailProtector) : base(globalSettings, umbracoContextAccessor, serviceContext, appCaches, profilingLogger, umbracoHelper) { _matchLocationDataSource = matchLocationDataSource ?? throw new System.ArgumentNullException(nameof(matchLocationDataSource)); _authorizationPolicy = authorizationPolicy ?? throw new System.ArgumentNullException(nameof(authorizationPolicy)); _apiKeyProvider = apiKeyProvider ?? throw new System.ArgumentNullException(nameof(apiKeyProvider)); _emailProtector = emailProtector ?? throw new System.ArgumentNullException(nameof(emailProtector)); }
public static async Task <Uri> AddKeyToQueryStringAsync( this IApiKeyProvider apiKeyProvider, Uri url, CancellationToken cancellationToken) { // Validate parameters. if (apiKeyProvider == null) { throw new ArgumentNullException(nameof(apiKeyProvider)); } if (url == null) { throw new ArgumentNullException(nameof(url)); } // Call the overload. return(new Uri(await apiKeyProvider.AddKeyToQueryStringAsync(url.ToString(), cancellationToken).ConfigureAwait(false))); }
public async Task InvokeAsync(HttpContext context, IApiKeyProvider apiKeyProvider) { if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var extractedApiKey)) { context.Response.StatusCode = 401; await context.Response.WriteAsync("Please provide ApiKey in Authorization header"); return; } if (!extractedApiKey.Equals(apiKeyProvider.GetApiKey())) { context.Response.StatusCode = 401; await context.Response.WriteAsync("Wrong ApiKey"); return; } await _next(context); }
private string GetRequestApiKeyId(HttpContext context) { var principal = context.User as ClaimsPrincipal; if (principal == null) { return(null); } Claim tokenClaim = principal.Claims.Where(c => c.Type == Core.Security.ClaimTypes.AccessToken).FirstOrDefault(); IApiKeyProvider keyProvider = (IApiKeyProvider)context.RequestServices.GetService(typeof(IApiKeyProvider)); if (tokenClaim == null || keyProvider == null) { return(null); } var requestKey = keyProvider.FindKey(tokenClaim.Value); return(requestKey == null ? null : requestKey.Id); }
public MockCensusApi(IApiKeyProvider keyService) { }
protected ApiKeyHandlerBase(IOptionsMonitor <ApiKeyOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IApiKeyProvider apiKeyValidationService) : base(options, logger, encoder, clock) { _apiKeyValidationService = apiKeyValidationService; }
public ApiKeyAuthHandler(IOptionsMonitor <ApiKeyAuthOptions> options, IApiKeyProvider apiKeyProvider, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock) { this.apiKeyProvider = apiKeyProvider; this.logger = logger; }
public MockBingMapsApi(IApiKeyProvider keyService) { }
public ApiKeyInQueryParamsHandler(IOptionsMonitor <ApiKeyOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IApiKeyProvider apiKeyValidationService) : base(options, logger, encoder, clock, apiKeyValidationService) { }
public ApiKeyResolver(IApiKeyProvider apiKeyProvider) : this() { ApiKeyProvider = apiKeyProvider; }
public SignatureService(SignatureServiceOptions options) { this.IDKeyMap = options.ApiKeyProvider; }
private void InitializeApis(IApiKeyProvider keyService) { map.Credentials = keyService.BingMapsKey; geolocator = new Geolocator(); geolocator.StatusChanged += geolocator_StatusChanged; }
public ApiKeyResolver(IApiKeyProvider apiKeyProvider, IApplicationNameProvider nameProvider) : this() { ApiKeyProvider = apiKeyProvider; ApplicationNameProvider = nameProvider; }
public ApiKeysController(IApiKeyProvider keyProvider) { _keyProvider = keyProvider ?? throw new ArgumentNullException(nameof(keyProvider)); }
protected ApiKeyRateLimitRequirement(long maxValue, TimeSpan renewalPeriod, bool sliding, IApiKeyProvider apiKeyProvider) : base(maxValue, renewalPeriod, sliding, apiKeyProvider) { }
public AlphaVantageStocksClientFactory(IApiKeyProvider apiKeyProvider) { _apiKeyProvider = apiKeyProvider; }