예제 #1
0
 public AuthorizeApiKeyFromRequest(IBrowserKeyProvider apiKeyProvider,
                                   IServerIpProvider serverIpProvider, IApiKeyRepository repo)
 {
     _apiKeyProvider   = apiKeyProvider;
     _serverIpProvider = serverIpProvider;
     _repo             = repo;
 }
 public ApiKeyProvider(
     ILogger <ApiKeyProvider> logger,
     IApiKeyRepository apiKeyRepository)
 {
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     _apiKeyRepository = apiKeyRepository ?? throw new ArgumentNullException(nameof(apiKeyRepository));
 }
 /// <summary>
 /// Creates a new instance of <see cref="ApplicationDeletedHandler"/>.
 /// </summary>
 /// <param name="repository">repos</param>
 public ApplicationDeletedHandler(IApiKeyRepository repository)
 {
     if (repository == null)
     {
         throw new ArgumentNullException("repository");
     }
     _repository = repository;
 }
예제 #4
0
 public ApiKeyProvider(IApiKeyRepository apiKeyRepository,
                       IProviderClient providerClient,
                       ProviderSettings providerSettings)
 {
     _apiKeyRepository = apiKeyRepository;
     _providerClient   = providerClient;
     _providerSettings = providerSettings;
 }
예제 #5
0
 public HmacSigningHandler(IApiKeyRepository apiKeyRepository,
                       IBuildMessageRepresentation representationBuilder,
                       ICalculateSignature signatureCalculator)
 {
     this.apiKeyRepository = apiKeyRepository;
     this.representationBuilder = representationBuilder;
     this.signatureCalculator = signatureCalculator;
 }
예제 #6
0
 public EncryptionService(IAmazonKeyManagementService kmsService,
                          IApiKeyRepository apiKeyRepository,
                          IOptions <AwsConfig> options)
 {
     this.apiKeyRepository = apiKeyRepository;
     this.kmsService       = kmsService ?? throw new ArgumentNullException(nameof(kmsService));
     this.kmsMasterKeyId   = options?.Value?.KmsMasterKeyId ?? throw new ArgumentNullException("KmsMasterKeyId");
     this.encryptedDataKey = options?.Value?.EncryptedDataKey ?? throw new ArgumentNullException("EncryptedDataKey");
 }
예제 #7
0
        public ApiKeysRepositoryShould()
        {
            _fakeLogger = new Mock <ILogger <IApiKeyRepository> >();
            _options    = InMemorySQLLite.CreateOptions <PaymentGatewayDBContext>();
            _context    = new PaymentGatewayDBContext(_options);
            _sut        = new ApiKeyRepository(_context, _fakeLogger.Object);

            _context.Database.EnsureCreated();
        }
예제 #8
0
 public AbstractDataController(IHttpContextAccessor ctx,
                               ISensorRepository sensors,
                               ISensorLinkRepository links,
                               IApiKeyRepository keys) : base(ctx)
 {
     this.m_sensors = sensors;
     this.m_links   = links;
     this.m_keys    = keys;
 }
예제 #9
0
 public ApiKeysController(IUserRepository users, IApiKeyRepository keys,
                          ILogger <ApiKeysController> logger,
                          ICommandPublisher publisher,
                          IHttpContextAccessor ctx) : base(users, ctx)
 {
     this._keys       = keys;
     this.m_logger    = logger;
     this.m_publisher = publisher;
 }
예제 #10
0
 public ApiKeyAuthenticationHandler(
     IOptionsMonitor <ApiKeyAuthenticationSchemeOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock,
     IApiKeyRepository keyRepository) : base(options, logger, encoder, clock)
 {
     _keyRepository = keyRepository;
 }
 public LiveDataHandlersController(
     IHttpContextAccessor ctx,
     ISensorLinkRepository links,
     ISensorRepository sensors,
     IApiKeyRepository keys,
     ILiveDataHandlerRepository repo) : base(ctx, sensors, links, keys)
 {
     this.m_repo = repo;
 }
예제 #12
0
 public AuthController(IAuthRepository authRepo, IMapper mapper, Constants constants,
                       IApiKeyRepository keyRepo, IUserRepository userRepository, IOptions <AppSettings> appSettings)
 {
     _authRepo       = authRepo;
     _mapper         = mapper;
     _constants      = constants;
     _keyRepo        = keyRepo;
     _userRepository = userRepository;
     _appSettings    = appSettings;
 }
예제 #13
0
 /// <summary>
 /// Sets up the service with all needed component.
 /// </summary>
 /// <param name="logger">A logger instance for local logging needs.</param>
 /// <param name="apiKeyRepository">Grants access to API keys.</param>
 /// <param name="apiKeyPermissionRepository">Grants write access to API key permissionss.</param>
 /// <param name="permissionService">Grants access to existing permission names.</param>
 public ApiKeyService(ILogger <ApiKeyService> logger,
                      IApiKeyRepository apiKeyRepository,
                      IApiKeyPermissionRepository apiKeyPermissionRepository,
                      PermissionService permissionService)
 {
     ApiKeyRepository           = apiKeyRepository;
     ApiKeyPermissionRepository = apiKeyPermissionRepository;
     PermissionService          = permissionService;
     Logger = logger;
 }
예제 #14
0
 public ExportController(IHttpContextAccessor ctx,
                         IMeasurementRepository measurements,
                         ISensorService sensorService,
                         ISensorRepository sensors,
                         ISensorLinkRepository links,
                         IApiKeyRepository keys) : base(ctx, sensors, links, keys)
 {
     this.m_measurements  = measurements;
     this.m_sensorService = sensorService;
 }
예제 #15
0
 public ApiKeyService(IApiKeyRepository apiKeyRepository,
                      ClaimsPrincipal principal,
                      IEncryptionService encryptionService,
                      IMapper mapper)
 {
     this.apiKeyRepository  = apiKeyRepository;
     this.principal         = principal;
     this.encryptionService = encryptionService;
     this.mapper            = mapper;
 }
예제 #16
0
 public MessagesController(IHttpContextAccessor ctx,
                           IMessageRepository messages,
                           ISensorLinkRepository links,
                           IApiKeyRepository keys,
                           ISensorService sensorService,
                           ISensorRepository sensors) : base(ctx, sensors, links, keys)
 {
     this.m_messages      = messages;
     this.m_sensorService = sensorService;
 }
예제 #17
0
 public ApiKeyAuthHandler(
     IOptionsMonitor <ApiKeyAuthenticationOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock,
     IApiKeyRepository keyService)
     : base(options, logger, encoder, clock)
 {
     _keyService = keyService;
 }
 public DemoDataService(IUserRepository userRepository,
                        IServiceRepository serviceRepository,
                        ISubscriptionRepository subscriptionRepository,
                        IApiKeyRepository apiKeyRepository)
 {
     _userRepository         = userRepository;
     _serviceRepository      = serviceRepository;
     _subscriptionRepository = subscriptionRepository;
     _apiKeyRepository       = apiKeyRepository;
 }
예제 #19
0
 public GoogleHttpClient(
     HttpClient httpClient,
     IAmbientFuckeryDatabase database,
     IApiKeyRepository apiKeyRepository
     )
 {
     this.httpClient       = httpClient;
     this.database         = database;
     this.apiKeyRepository = apiKeyRepository;
 }
 public TriggersController(IHttpContextAccessor ctx,
                           ISensorRepository sensors,
                           ISensorLinkRepository links,
                           ITriggerAdministrationRepository triggers,
                           ICommandPublisher publisher,
                           IApiKeyRepository keys) : base(ctx, sensors, links, keys)
 {
     this.m_triggers = triggers;
     this.m_mqtt     = publisher;
 }
 public BlobsController(IHttpContextAccessor ctx,
                        ISensorRepository sensors,
                        ISensorLinkRepository links,
                        IBlobRepository blobs,
                        IBlobService blobService,
                        IApiKeyRepository keys) : base(ctx, sensors, links, keys)
 {
     this.m_blobs       = blobs;
     this.m_blobService = blobService;
 }
예제 #22
0
 public UserController(IUserRepository userRepo, IFileRepository fileRepo, IMapper mapper,
                       IUtilsService utilsService, IAlbumRepository albumRepo, IApiKeyRepository apiKeyRepo, IAuthRepository authRepo)
 {
     _userRepo     = userRepo;
     _fileRepo     = fileRepo;
     _mapper       = mapper;
     _utilsService = utilsService;
     _albumRepo    = albumRepo;
     _apiKeyRepo   = apiKeyRepo;
     _authRepo     = authRepo;
 }
예제 #23
0
 public YouTubeParser(
     IOptions <AppSettings> options,
     ILogger <YouTubeParser> logger,
     IApiKeyRepository keyRepository,
     IHttpClientFactory httpFactory,
     IExternalServiceRequestLogger serviceRequestLogger)
 {
     _logger               = logger;
     _keyRepository        = keyRepository;
     _httpFactory          = httpFactory;
     _serviceRequestLogger = serviceRequestLogger;
 }
 public MeasurementsController(IMeasurementRepository measurements,
                               ISensorService sensorService,
                               ISensorLinkRepository links,
                               ISensorRepository sensors,
                               IApiKeyRepository keys,
                               ILogger <MeasurementsController> logger,
                               IHttpContextAccessor ctx) : base(ctx, sensors, links, keys)
 {
     this.m_measurements  = measurements;
     this.m_sensorService = sensorService;
     this.m_logger        = logger;
 }
예제 #25
0
 public TokensController(
     IUserTokenRepository tokens,
     IOptions <UserAccountSettings> options,
     IUserRepository users,
     SignInManager <SensateUser> signInManager,
     IApiKeyRepository keys,
     IHttpContextAccessor ctx
     ) : base(users, ctx)
 {
     this._tokens         = tokens;
     this._signin_manager = signInManager;
     this._settings       = options.Value;
     this._keys           = keys;
 }
예제 #26
0
 public ApiKeyService(
     ILogger <IApiKeyRepository> logger,
     IApiKeyRepository apiKeyRepository,
     IApiApiKeyRequestModelValidator apiKeyModelValidator,
     IBOLApiKeyMapper bolapiKeyMapper,
     IDALApiKeyMapper dalapiKeyMapper
     )
     : base(logger,
            apiKeyRepository,
            apiKeyModelValidator,
            bolapiKeyMapper,
            dalapiKeyMapper)
 {
 }
예제 #27
0
 public AbstractApiKeyService(
     ILogger logger,
     IApiKeyRepository apiKeyRepository,
     IApiApiKeyRequestModelValidator apiKeyModelValidator,
     IBOLApiKeyMapper bolApiKeyMapper,
     IDALApiKeyMapper dalApiKeyMapper)
     : base()
 {
     this.apiKeyRepository     = apiKeyRepository;
     this.apiKeyModelValidator = apiKeyModelValidator;
     this.bolApiKeyMapper      = bolApiKeyMapper;
     this.dalApiKeyMapper      = dalApiKeyMapper;
     this.logger = logger;
 }
 public StatisticsController(ISensorRepository sensors,
                             ISystemStatisticsRepository systemStats,
                             ISensorLinkRepository links,
                             IAuditLogRepository logs,
                             IUserRepository users,
                             IBlobRepository blobs,
                             IApiKeyRepository keys,
                             ILogger <StatisticsController> loger,
                             IHttpContextAccessor ctx) : base(ctx, sensors, links, keys)
 {
     this._sensors      = sensors;
     this.m_logger      = loger;
     this.m_auditlogs   = logs;
     this.m_users       = users;
     this.m_blobs       = blobs;
     this.m_systemStats = systemStats;
 }
예제 #29
0
 public SensorsController(IHttpContextAccessor ctx,
                          ISensorRepository sensors,
                          ILogger <SensorsController> logger,
                          ISensorLinkRepository links,
                          ITriggerAdministrationRepository triggers,
                          ISensorService sensorService,
                          IAccountRepository accounts,
                          IApiKeyRepository keys,
                          IDistributedCache <PaginationResponse <Sensor> > cache,
                          ICommandPublisher mqtt) : base(ctx, sensors, links, keys)
 {
     this.m_logger        = logger;
     this.m_sensorService = sensorService;
     this.m_mqtt          = mqtt;
     this.m_triggers      = triggers;
     this.m_accounts      = accounts;
     this.m_cache         = cache;
     this.m_rng           = new Random(DateTime.UtcNow.Millisecond * DateTime.UtcNow.Second);
 }
 public GatewayController(IMeasurementAuthorizationService measurementAuth,
                          IMessageAuthorizationService messageAuth,
                          IHttpContextAccessor ctx,
                          ISensorRepository sensors,
                          IApiKeyRepository keys,
                          ISensorLinkRepository links,
                          IBlobRepository blobs,
                          IBlobService blobService,
                          IRouterClient client,
                          IAuthorizationService auth,
                          ILogger <GatewayController> logger) : base(ctx, sensors, links, keys)
 {
     this.m_measurementAuthorizationService = measurementAuth;
     this.m_messageAuthorizationService     = messageAuth;
     this.m_blobService = blobService;
     this.m_blobs       = blobs;
     this.m_client      = client;
     this.m_logger      = logger;
     this.m_auth        = auth;
 }
        public AbstractApiController(
            IHttpContextAccessor ctx,
            ISensorRepository sensors,
            ISensorLinkRepository links,
            IApiKeyRepository keys
            )
        {
            if (ctx?.HttpContext == null)
            {
                return;
            }

            var key = ctx.HttpContext.Items["ApiKey"] as ApiKey;

            this.ApiKey          = key;
            this.CurrentUser     = key?.User;
            this.m_currentUserId = key?.UserId.ToString();
            this.m_sensors       = sensors;
            this.m_links         = links;
            this.m_keys          = keys;
        }
예제 #32
0
 public AdminController(IApplicationRepository controller, IApiKeyRepository keyController)
 {
     this.controller = controller;
     this.keyController = keyController;
 }
예제 #33
0
 public HomeController(IApiKeyRepository apiKeyRepository, IPricingService pricingService)
 {
     _apiKeyRepository = apiKeyRepository;
     _pricingService = pricingService;
 }
예제 #34
0
 public IndustryController(IApiKeyRepository apiKeyRepository)
 {
     _apiKeyRepository = apiKeyRepository;
 }