Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="identityProviderStore"></param>
 /// <param name="mapper"></param>
 /// <param name="distributedCache"></param>
 public IdentityProvidersController(IOspIdentityProviderStore identityProviderStore, IMapper mapper,
                                    IDistributedWithPubSubCache distributedCache)
 {
     _identityProviderStore = identityProviderStore;
     _mapper           = mapper;
     _distributedCache = distributedCache;
 }
Exemplo n.º 2
0
        public SystemContext(IOptions <OspSystemConfiguration> systemConfiguration,
                             IDistributedWithPubSubCache distributedWithPubSubCache)
        {
            ArgumentValidation.Validate(nameof(systemConfiguration), systemConfiguration);
            ArgumentValidation.Validate(nameof(distributedWithPubSubCache), distributedWithPubSubCache);

            _systemConfiguration        = systemConfiguration.Value;
            _distributedWithPubSubCache = distributedWithPubSubCache;

            var sharedSettings = new MongoConnectionOptions
            {
                MongoDbHost          = _systemConfiguration.DatabaseHost,
                MongoDbUsername      = _systemConfiguration.AdminUser,
                MongoDbPassword      = _systemConfiguration.AdminUserPassword,
                AuthenticationSource = _systemConfiguration.AuthenticationDatabaseName
            };

            _ckCaches = new ConcurrentDictionary <string, ICkCache>();

            _repositoryClient = new MongoRepositoryClient(sharedSettings);
            OspSystemDatabase = _repositoryClient.GetRepository(_systemConfiguration.SystemDatabaseName);

            _tenantCollection        = OspSystemDatabase.GetCollection <SystemEntities.OspTenant>();
            _configurationCollection = OspSystemDatabase.GetCollection <OspConfiguration>();

            var sub = _distributedWithPubSubCache.Subscribe <string>(CacheCommon.KeyTenantUpdate);

            sub.OnMessage(message =>
            {
                RemoveCkCache(message.Message);
                return(Task.CompletedTask);
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="systemContext"></param>
        /// <param name="distributedCache"></param>
        public ServiceHookService(ISystemContext systemContext, IDistributedWithPubSubCache distributedCache)
        {
            _systemContext = systemContext;
            var sub = distributedCache.Subscribe <string>(CacheCommon.KeyTenantUpdate);

            sub.OnMessage(async message => { await SyncDataSourceAndCreateJobsAsync(); });
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sgIdentityProviderStore">Data storage of identity providers</param>
        /// <param name="schemeProvider">Scheme provider</param>
        /// <param name="authSchemeCreatorFactory">Factory to resolve creators of auth providers.</param>
        /// <param name="distributedCache">Memory cache do distribute events (if identity providers has changed.</param>
        public DynamicAuthSchemeService(IOspIdentityProviderStore sgIdentityProviderStore,
                                        IAuthenticationSchemeProvider schemeProvider,
                                        IAuthSchemeCreatorFactory authSchemeCreatorFactory,
                                        IDistributedWithPubSubCache distributedCache)
        {
            _sgIdentityProviderStore  = sgIdentityProviderStore;
            _schemeProvider           = schemeProvider;
            _authSchemeCreatorFactory = authSchemeCreatorFactory;

            var channel = distributedCache.Subscribe <string>(CacheCommon.KeyIdentityProviderUpdate);

            channel.OnMessage(async message => { await ConfigureAsync(); });
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ospService">The OSP service</param>
        /// <param name="distributedWithPubSubCache"></param>
        public SchemaContext(IOspService ospService, IDistributedWithPubSubCache distributedWithPubSubCache)
        {
            _ospService = ospService;

            _cache = new MemoryCache(new MemoryCacheOptions
            {
                SizeLimit = 64
            });

            var sub = distributedWithPubSubCache.Subscribe <string>(CacheCommon.KeyTenantUpdate);

            sub.OnMessage(message =>
            {
                _cache.Remove(message.Message.MakeKey());
                return(Task.CompletedTask);
            });
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="systemContext">System context object</param>
 /// <param name="distributedCache">Redis distributed cache for file caching</param>
 public ExportModelJob(ISystemContext systemContext, IDistributedWithPubSubCache distributedCache)
 {
     _systemContext    = systemContext;
     _distributedCache = distributedCache;
 }
Exemplo n.º 7
0
 public IndexModel(IDistributedWithPubSubCache cache)
 {
     _cache = cache;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="distributedCache">Instance of distributed cache</param>
 /// <param name="backgroundJobClient">The hangfire job client</param>
 public ModelsController(IDistributedWithPubSubCache distributedCache, IBackgroundJobClient backgroundJobClient)
 {
     _distributedCache    = distributedCache;
     _backgroundJobClient = backgroundJobClient;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="systemContext">System context object</param>
 /// <param name="distributedCache">Redis distributed cache for file caching</param>
 public AttributeValueAggregatorJob(ISystemContext systemContext, IDistributedWithPubSubCache distributedCache)
 {
     _systemContext    = systemContext;
     _distributedCache = distributedCache;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clientStore">Client store object to access all available clients.</param>
 /// <param name="distributedCache">Instance of distributed cache</param>
 public CorsPolicyProvider(IOspClientStore clientStore, IDistributedWithPubSubCache distributedCache)
 {
     _clientStore = clientStore;
     _channel     = distributedCache.Subscribe <string>(CacheCommon.KeyCorsClients);
     _channel.OnMessage(OnInvalidateData);
 }
Exemplo n.º 11
0
 public HomeController(IDistributedWithPubSubCache distributedCache)
 {
     _distributedCache = distributedCache;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ospClientStore">The storage service of clients</param>
 /// <param name="distributedCache">Distributed cache with REDIS</param>
 public ClientsController(IOspClientStore ospClientStore, IDistributedWithPubSubCache distributedCache)
 {
     _ospClientStore   = ospClientStore;
     _distributedCache = distributedCache;
 }