Esempio n. 1
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);
            });
        }
Esempio n. 2
0
        public ResourceStore(ISystemContext systemContext)
        {
            _repository = systemContext.OspSystemDatabase;

            _apiResourceCollection      = _repository.GetCollection <OspApiResource>();
            _identityResourceCollection = _repository.GetCollection <OspIdentityResource>();
            _apiScopeCollection         = _repository.GetCollection <OspApiScope>();
        }
Esempio n. 3
0
        internal StatementCreator(ICachedCollection <TEntity> cachedCollection, string language = "en")
        {
            _cachedCollection = cachedCollection;

            Language = language;

            _idFilters             = new List <FilterDefinition <TEntity> >();
            _fieldFilters          = new List <FilterDefinition <TEntity> >();
            _attributeSearchFilter = new List <FilterDefinition <TEntity> >();
            _sortDefinitions       = new List <SortDefinition <TEntity> >();

            _bsonClassMap = new BsonClassMap <TEntity>();
            _bsonClassMap.AutoMap();
        }
Esempio n. 4
0
        public PermissionStore(ISystemContext systemContext)
        {
            _repository = systemContext.OspSystemDatabase;

            _permissionCollection = _repository.GetCollection <OspPermission>();
        }
Esempio n. 5
0
        public IdentityProviderStore(ISystemContext systemContext)
        {
            _repository = systemContext.OspSystemDatabase;

            _providerCollection = _repository.GetCollection <OspIdentityProvider>();
        }
Esempio n. 6
0
 public PersistentGrantStore(ISystemContext systemContext)
 {
     _repository = systemContext.OspSystemDatabase;
     _persistentGrantCollection = _repository.GetCollection <OspPersistedGrant>();
 }
 public ClientStore(ISystemContext systemContext)
 {
     _repository       = systemContext.OspSystemDatabase;
     _clientCollection = _repository.GetCollection <OspClient>();
 }