public void SilverlightWasRequested(IResourceStore resourceStore)
		{
			var documentDatabase = ((DocumentDatabase)resourceStore);
			if (documentDatabase.GetIndexDefinition("Raven/DocumentsByEntityName") == null)
			{
				documentDatabase.PutIndex("Raven/DocumentsByEntityName", new IndexDefinition
				{
					Map =
						@"from doc in docs 
let Tag = doc[""@metadata""][""Raven-Entity-Name""]
where  Tag != null 
select new { Tag };",
					Indexes = { { "Tag", FieldIndexing.NotAnalyzed } },
					Stores = { { "Tag", FieldStorage.No } }
				});
			}

			if (documentDatabase.GetIndexDefinition("Raven/DocumentCollections") == null)
			{
				documentDatabase.PutIndex("Raven/DocumentCollections", new IndexDefinition
				{
					Map =
						@"from doc in docs
let Name = doc[""@metadata""][""Raven-Entity-Name""]
where Name != null
select new { Name , Count = 1}
",
					Reduce =
						@"from result in results
group result by result.Name into g
select new { Name = g.Key, Count = g.Sum(x=>x.Count) }"
				});
			}
		}
Example #2
0
        protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database)
        {
            if (ResourcesStoresCache.TryGetValue(tenantId, out database))
                return true;

            var jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null);

            if (jsonDocument == null)
                return false;

            var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>();

            database = ResourcesStoresCache.GetOrAdd(tenantId, s =>
            {
                var config = new InMemroyRavenConfiguration
                {
                    Settings = DefaultConfiguration.Settings,
                };
                config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;
                foreach (var setting in document.Settings)
                {
                    config.Settings[setting.Key] = setting.Value;
                }
                config.Initialize();
                return new DocumentDatabase(config);
            });
            return true;


        }
Example #3
0
 public WindowManager(IEnvWindowsManager envWindowsManager, IHostedControls hostedControls, IResourceStore resourceStore, IThemeManager themeManager)
 {
     _envWindowsManager = envWindowsManager;
     _hostedControls = hostedControls;
     _resourceStore = resourceStore;
     _themeManager = themeManager;
 }
 public ConsentController(
     ILogger<ConsentController> logger,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IResourceStore resourceStore)
 {
     _logger = logger;
     _interaction = interaction;
     _clientStore = clientStore;
     _resourceStore = resourceStore;
 }
Example #5
0
        /// <summary>
        /// Creates a new empty resource index in the specified page store
        /// </summary>
        /// <param name="txnId"></param>
        /// <param name="pageStore"></param>
        /// <param name="resourceTable"></param>
        public ResourceIndex(ulong txnId, IPageStore pageStore, IResourceTable resourceTable)  : base(txnId, pageStore)
        {
            //_resourceCache = new ConcurrentResourceCache();
            //_resourceIdCache = new ConcurrentResourceIdCache();
            _resourceCache = new LruResourceCache();
            _resourceIdCache = new LruResourceIdCache();
            _resourceStore = new ResourceStore(resourceTable);
#if DEBUG_BTREE
            Configuration.DebugId = "ResIx";
            Logging.LogDebug("Created new {0} BTree with root page {1}", Configuration.DebugId, RootId);
#endif
        }
Example #6
0
        /// <summary>
        /// Opens an existing resource index from the specified page store
        /// </summary>
        /// <param name="pageStore"></param>
        /// <param name="resourceTable">The table used to store long resource strings</param>
        /// <param name="rootNodeId">The ID of the page that contains the root node of the resource index</param>
        public ResourceIndex(IPageStore pageStore, IResourceTable resourceTable, ulong rootNodeId) : base(pageStore, rootNodeId)
        {
            //_resourceCache = new ConcurrentResourceCache();
            //_resourceIdCache = new ConcurrentResourceIdCache();
            _resourceCache= new LruResourceCache();
            _resourceIdCache = new LruResourceIdCache();
            _resourceStore = new ResourceStore(resourceTable);
#if DEBUG_BTREE
            Configuration.DebugId = "ResIx";
            Logging.LogDebug("Opened new {0} BTree with root page {1}", Configuration.DebugId, rootNodeId);
#endif
        }
Example #7
0
        protected HttpServer(IRaveHttpnConfiguration configuration, IResourceStore resourceStore)
        {
            DefaultResourceStore = resourceStore;
            DefaultConfiguration = configuration;

            configuration.Container.SatisfyImportsOnce(this);

            foreach (var requestResponder in RequestResponders)
            {
                requestResponder.Value.Initialize(() => currentDatabase.Value, () => currentConfiguration.Value);
            }
        }
        public static EncryptionSettings GetEncryptionSettingsForResource(IResourceStore resource)
        {
            var result = (EncryptionSettings)resource.ExtensionsState.GetOrAdd(EncryptionSettingsKeyInExtensionsState, _ =>
            {
                var type = GetTypeFromName(resource.Configuration.Settings[Constants.AlgorithmTypeSetting]);
                var key = GetKeyFromBase64(resource.Configuration.Settings[Constants.EncryptionKeySetting], resource.Configuration.Encryption.EncryptionKeyBitsPreference);
                var encryptIndexes = GetEncryptIndexesFromString(resource.Configuration.Settings[Constants.EncryptIndexes], true);

                return new EncryptionSettings(key, type, encryptIndexes, resource.Configuration.Encryption.EncryptionKeyBitsPreference);
            });

            return result;
        }
Example #9
0
        protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database)
        {
            if (ResourcesStoresCache.TryGetValue(tenantId, out database))
                return true;

            JsonDocument jsonDocument;
            
            using (DocumentRetriever.DisableReadTriggers())
                jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null);

            if (jsonDocument == null)
                return false;

            var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>();

            database = ResourcesStoresCache.GetOrAdd(tenantId, s =>
            {
                var config = new InMemoryRavenConfiguration
                {
                    Settings = DefaultConfiguration.Settings,
                };
				foreach (var setting in document.Settings)
				{
					config.Settings[setting.Key] = setting.Value;
				}
            	var dataDir = config.Settings["Raven/DataDir"];
				if(dataDir == null)
					throw new InvalidOperationException("Could not find Raven/DataDir");
				if(dataDir.StartsWith("~/") || dataDir.StartsWith(@"~\"))
				{
					var baseDataPath = Path.GetDirectoryName(DefaultDatabase.Configuration.DataDirectory);
					if(baseDataPath == null)
						throw new InvalidOperationException("Could not find root data path");
					config.Settings["Raven/DataDir"] = Path.Combine(baseDataPath, dataDir.Substring(2));
				}
            	config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;
             
                config.Initialize();
                var documentDatabase = new DocumentDatabase(config);
                documentDatabase.SpinBackgroundWorkers();
                return documentDatabase;
            });
            return true;


        }
Example #10
0
		public bool Authenticate(IResourceStore currentStore, string username, string password, out string[] allowedDatabases)
		{
			allowedDatabases = new string[0];

			var jsonDocument = ((DocumentDatabase)currentStore).Get("Raven/Users/"+username, null);
			if (jsonDocument == null)
			{
				return false;
			}

			var user = jsonDocument.DataAsJson.JsonDeserialization<AuthenticationUser>();

			var validatePassword = user.ValidatePassword(password);
			if (validatePassword)
				allowedDatabases = user.AllowedDatabases;

			return validatePassword;
		}
Example #11
0
        public TestViewModel(IServiceLocator serviceFactory)
        {
            this.serviceFactory = serviceFactory;
            loggingService = serviceFactory.Resolve<ILoggingService>();
            var resourceService = serviceFactory.Resolve<IResourceService>();
            resources = resourceService.RetrieveResourceStore(this.GetType());
            resources.SetInt("Test", 5);

            GridA = new List<MatrixRow>();
            GridB = new List<MatrixRow>();
            GridC = new ObservableCollection<MatrixRow>();

            var r = new Random();
            for (int i = 0; i < 3; i++)
            {
                GridA.Add(new MatrixRow(r.Next(100), r.Next(100), r.Next(100)));
                GridB.Add(new MatrixRow(r.Next(100), r.Next(100), r.Next(100)));
                GridC.Add(new MatrixRow(null, null, null));
            }

            CalculateCommand = new RelayCommand(HandleCalculateCommand);
        }
		public void SilverlightWasRequested(IResourceStore resourceStore)
		{
			var documentDatabase = ((DocumentDatabase)resourceStore);
			if (documentDatabase.GetIndexDefinition("Raven/DocumentsByEntityName") == null)
			{
				documentDatabase.PutIndex("Raven/DocumentsByEntityName", new IndexDefinition
				{
					Map =
						@"from doc in docs 
let Tag = doc[""@metadata""][""Raven-Entity-Name""]
where  Tag != null 
select new { Tag, LastModified = (DateTime)doc[""@metadata""][""Last-Modified""] };",
					Indexes =
					{
						{"Tag", FieldIndexing.NotAnalyzed},
					},
					Stores =
					{
						{"Tag", FieldStorage.No},
						{"LastModified", FieldStorage.No}
					}
				});
			}
		}
Example #13
0
        public void Run(IOperationContext operationContext, IResourceStore resourceStore)
        {
            var currentState = operationContext.GetCurrentState();

            currentState.FontState.CharacterSpacing = Spacing;
        }
Example #14
0
 protected override bool TryGetOrCreateResourceStore(string name, out IResourceStore database)
 {
     database = null;
     return false;
 }
Example #15
0
 public RavenDbHttpServer(IRaveHttpnConfiguration configuration, IResourceStore database)
     : base(configuration, database)
 {
 }
Example #16
0
 protected abstract bool TryGetOrCreateResourceStore(string name, out IResourceStore database);
Example #17
0
        public static AuthorizeRequestValidator CreateAuthorizeRequestValidator(
            IdentityServerOptions options = null,
            IResourceStore resourceStore  = null,
            IClientStore clients          = null,
            IProfileService profile       = null,
            ICustomAuthorizeRequestValidator customValidator = null,
            IRedirectUriValidator uriValidator               = null,
            IResourceValidator resourceValidator             = null,
            JwtRequestValidator jwtRequestValidator          = null,
            IJwtRequestUriHttpClient jwtRequestUriHttpClient = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (resourceStore == null)
            {
                resourceStore = new InMemoryResourcesStore(TestScopes.GetIdentity(), TestScopes.GetApis(), TestScopes.GetScopes());
            }

            if (clients == null)
            {
                clients = new InMemoryClientStore(TestClients.Get());
            }

            if (customValidator == null)
            {
                customValidator = new DefaultCustomAuthorizeRequestValidator();
            }

            if (uriValidator == null)
            {
                uriValidator = new StrictRedirectUriValidator();
            }

            if (resourceValidator == null)
            {
                resourceValidator = CreateResourceValidator(resourceStore);
            }

            if (jwtRequestValidator == null)
            {
                jwtRequestValidator = new JwtRequestValidator("https://identityserver", new LoggerFactory().CreateLogger <JwtRequestValidator>());
            }

            if (jwtRequestUriHttpClient == null)
            {
                jwtRequestUriHttpClient = new DefaultJwtRequestUriHttpClient(new HttpClient(new NetworkHandler(new Exception("no jwt request uri response configured"))), options, new LoggerFactory());
            }


            var userSession = new MockUserSession();

            return(new AuthorizeRequestValidator(
                       options,
                       clients,
                       customValidator,
                       uriValidator,
                       resourceValidator,
                       userSession,
                       jwtRequestValidator,
                       jwtRequestUriHttpClient,
                       TestLogger.Create <AuthorizeRequestValidator>()));
        }
Example #18
0
 public LegacySkin(SkinInfo skin, IResourceStore <byte[]> storage, AudioManager audioManager)
     : this(skin, new LegacySkinResourceStore <SkinFileInfo>(skin, storage), audioManager, "skin.ini")
 {
 }
Example #19
0
 internal static IResourceValidator CreateResourceValidator(IResourceStore store = null)
 {
     store = store ?? new InMemoryResourcesStore(TestScopes.GetIdentity(), TestScopes.GetApis(), TestScopes.GetScopes());
     return(new DefaultResourceValidator(store, new DefaultScopeParser(TestLogger.Create <DefaultScopeParser>()), TestLogger.Create <DefaultResourceValidator>()));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserInfoResponseGenerator"/> class.
 /// </summary>
 /// <param name="profile">The profile.</param>
 /// <param name="resourceStore">The resource store.</param>
 /// <param name="logger">The logger.</param>
 public UserInfoResponseGenerator(IProfileService profile, IResourceStore resourceStore, ILogger <UserInfoResponseGenerator> logger)
 {
     Profile   = profile;
     Resources = resourceStore;
     Logger    = logger;
 }
Example #21
0
 public LegacyBeatmapSkin(BeatmapInfo beatmapInfo, IResourceStore <byte[]> storage, IStorageResourceProvider resources)
     : base(createSkinInfo(beatmapInfo), new LegacySkinResourceStore <BeatmapSetFileInfo>(beatmapInfo.BeatmapSet, storage), resources, beatmapInfo.Path)
 {
     // Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
     Configuration.AllowDefaultComboColoursFallback = false;
 }
Example #22
0
        public SkinManager(Storage storage, DatabaseContextFactory contextFactory, GameHost host, IResourceStore <byte[]> resources, AudioManager audio)
            : base(storage, contextFactory, new SkinStore(contextFactory, storage), host)
        {
            this.audio     = audio;
            this.host      = host;
            this.resources = resources;

            DefaultLegacySkin = new DefaultLegacySkin(this);
            DefaultSkin       = new DefaultSkin(this);

            CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);

            CurrentSkin.Value         = DefaultSkin;
            CurrentSkin.ValueChanged += skin =>
            {
                if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
                {
                    throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead.");
                }

                SourceChanged?.Invoke();
            };
        }
Example #23
0
 public ScopeValidation()
 {
     _store = new InMemoryResourcesStore(_identityResources, _apiResources);
 }
Example #24
0
 IResourceStore <TextureUpload> IStorageResourceProvider.CreateTextureLoaderStore(IResourceStore <byte[]> underlyingStore) => host.CreateTextureLoaderStore(underlyingStore);
Example #25
0
        public static XObjectImage ReadImage(XObjectContentRecord xObject, IPdfTokenScanner pdfScanner,
                                             IFilterProvider filterProvider,
                                             IResourceStore resourceStore)
        {
            if (xObject == null)
            {
                throw new ArgumentNullException(nameof(xObject));
            }

            if (xObject.Type != XObjectType.Image)
            {
                throw new InvalidOperationException($"Cannot create an image from an XObject with type: {xObject.Type}.");
            }

            var dictionary = xObject.Stream.StreamDictionary;

            var bounds = xObject.AppliedTransformation.Transform(new PdfRectangle(new PdfPoint(0, 0), new PdfPoint(1, 1)));

            var width  = dictionary.Get <NumericToken>(NameToken.Width, pdfScanner).Int;
            var height = dictionary.Get <NumericToken>(NameToken.Height, pdfScanner).Int;

            var isImageMask = dictionary.TryGet(NameToken.ImageMask, pdfScanner, out BooleanToken isMaskToken) &&
                              isMaskToken.Data;

            var isJpxDecode = dictionary.TryGet(NameToken.Filter, out var token) &&
                              token is NameToken filterName &&
                              filterName.Equals(NameToken.JpxDecode);

            int bitsPerComponent = 0;

            if (!isImageMask && !isJpxDecode)
            {
                if (!dictionary.TryGet(NameToken.BitsPerComponent, pdfScanner, out NumericToken bitsPerComponentToken))
                {
                    throw new PdfDocumentFormatException($"No bits per component defined for image: {dictionary}.");
                }

                bitsPerComponent = bitsPerComponentToken.Int;
            }
            else if (isImageMask)
            {
                bitsPerComponent = 1;
            }

            var intent = xObject.DefaultRenderingIntent;

            if (dictionary.TryGet(NameToken.Intent, out NameToken renderingIntentToken))
            {
                intent = renderingIntentToken.Data.ToRenderingIntent();
            }

            var interpolate = dictionary.TryGet(NameToken.Interpolate, pdfScanner, out BooleanToken interpolateToken) &&
                              interpolateToken.Data;

            DictionaryToken filterDictionary = xObject.Stream.StreamDictionary;

            if (xObject.Stream.StreamDictionary.TryGet(NameToken.Filter, out var filterToken) &&
                filterToken is IndirectReferenceToken)
            {
                if (filterDictionary.TryGet(NameToken.Filter, pdfScanner, out ArrayToken filterArray))
                {
                    filterDictionary = filterDictionary.With(NameToken.Filter, filterArray);
                }
                else if (filterDictionary.TryGet(NameToken.Filter, pdfScanner, out NameToken filterNameToken))
                {
                    filterDictionary = filterDictionary.With(NameToken.Filter, filterNameToken);
                }
                else
                {
                    filterDictionary = null;
                }
            }

            var supportsFilters = filterDictionary != null;

            if (filterDictionary != null)
            {
                var filters = filterProvider.GetFilters(filterDictionary);
                foreach (var filter in filters)
                {
                    if (!filter.IsSupported)
                    {
                        supportsFilters = false;
                        break;
                    }
                }
            }

            var decodedBytes = supportsFilters ? new Lazy <IReadOnlyList <byte> >(() => xObject.Stream.Decode(filterProvider))
                : null;

            var decode = EmptyArray <decimal> .Instance;

            if (dictionary.TryGet(NameToken.Decode, pdfScanner, out ArrayToken decodeArrayToken))
            {
                decode = decodeArrayToken.Data.OfType <NumericToken>()
                         .Select(x => x.Data)
                         .ToArray();
            }

            var colorSpace = default(ColorSpace?);

            if (!isImageMask)
            {
                if (dictionary.TryGet(NameToken.ColorSpace, pdfScanner, out NameToken colorSpaceNameToken) &&
                    TryMapColorSpace(colorSpaceNameToken, resourceStore, out var colorSpaceResult))
                {
                    colorSpace = colorSpaceResult;
                }
                else if (dictionary.TryGet(NameToken.ColorSpace, pdfScanner, out ArrayToken colorSpaceArrayToken) &&
                         colorSpaceArrayToken.Length > 0)
                {
                    var first = colorSpaceArrayToken.Data[0];

                    if ((first is NameToken firstColorSpaceName) && TryMapColorSpace(firstColorSpaceName, resourceStore, out colorSpaceResult))
                    {
                        colorSpace = colorSpaceResult;
                    }
                }
                else if (!isJpxDecode)
                {
                    colorSpace = xObject.DefaultColorSpace;
                }
            }

            var details = ColorSpaceDetailsParser.GetColorSpaceDetails(colorSpace, dictionary, pdfScanner, resourceStore, filterProvider);

            return(new XObjectImage(
                       bounds,
                       width,
                       height,
                       bitsPerComponent,
                       colorSpace,
                       isJpxDecode,
                       isImageMask,
                       intent,
                       interpolate,
                       decode,
                       dictionary,
                       xObject.Stream.Data,
                       decodedBytes,
                       details));
        }
Example #26
0
 internal TrackStore(IResourceStore <byte[]> store)
 {
     this.store = store;
 }
Example #27
0
 public void Run(IOperationContext operationContext, IResourceStore resourceStore)
 {
 }
Example #28
0
 public TestLegacySkin(IResourceStore <TextureUpload> textureStore)
     : base(new SkinInfo(), new TestResourceProvider(textureStore), null, string.Empty)
 {
 }
Example #29
0
 public LegacySkinResourceStore(IHasFiles <T> source, IResourceStore <byte[]> underlyingStore)
 {
     this.source          = source;
     this.underlyingStore = underlyingStore;
 }
Example #30
0
 public override IResourceStore <TextureUpload> CreateTextureLoaderStore(IResourceStore <byte[]> underlyingStore)
 => new AndroidTextureLoaderStore(underlyingStore);
Example #31
0
 /// <summary>
 /// Opens an existing resource index from the specified page store
 /// </summary>
 /// <param name="pageStore"></param>
 /// <param name="resourceTable">The table used to store long resource strings</param>
 /// <param name="rootNodeId">The ID of the page that contains the root node of the resource index</param>
 public ResourceIndex(IPageStore pageStore, IResourceTable resourceTable, ulong rootNodeId) : base(pageStore, rootNodeId)
 {
     _resourceCache = new ConcurrentResourceCache();
     _resourceIdCache = new ConcurrentResourceIdCache();
     _resourceStore = new ResourceStore(resourceTable);
 }
Example #32
0
 public ResourceBuilder(IResourceStore resourceStore, IResourceService serivce)
 {
     _resourceStore = resourceStore;
     _serivce       = serivce;
 }
 public TrackManager(IResourceStore <byte[]> store)
 {
     this.store = store;
 }
Example #34
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IResourceStore resourceStore  = null,
            IAuthorizationCodeStore authorizationCodeStore         = null,
            IRefreshTokenStore refreshTokenStore                   = null,
            IResourceOwnerPasswordValidator resourceOwnerValidator = null,
            IProfileService profile = null,
            IDeviceCodeValidator deviceCodeValidator = null,
            IEnumerable <IExtensionGrantValidator> extensionGrantValidators = null,
            ICustomTokenRequestValidator customRequestValidator             = null,
            ITokenValidator tokenValidator           = null,
            IRefreshTokenService refreshTokenService = null,
            IResourceValidator resourceValidator     = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (resourceStore == null)
            {
                resourceStore = new InMemoryResourcesStore(TestScopes.GetIdentity(), TestScopes.GetApis(), TestScopes.GetScopes());
            }

            if (resourceOwnerValidator == null)
            {
                resourceOwnerValidator = new TestResourceOwnerPasswordValidator();
            }

            if (profile == null)
            {
                profile = new TestProfileService();
            }

            if (deviceCodeValidator == null)
            {
                deviceCodeValidator = new TestDeviceCodeValidator();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomTokenRequestValidator();
            }

            ExtensionGrantValidator aggregateExtensionGrantValidator;

            if (extensionGrantValidators == null)
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(new[] { new TestGrantValidator() }, TestLogger.Create <ExtensionGrantValidator>());
            }
            else
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(extensionGrantValidators, TestLogger.Create <ExtensionGrantValidator>());
            }

            if (authorizationCodeStore == null)
            {
                authorizationCodeStore = CreateAuthorizationCodeStore();
            }

            if (refreshTokenStore == null)
            {
                refreshTokenStore = CreateRefreshTokenStore();
            }

            if (resourceValidator == null)
            {
                resourceValidator = CreateResourceValidator(resourceStore);
            }

            if (tokenValidator == null)
            {
                tokenValidator = CreateTokenValidator(refreshTokenStore: refreshTokenStore, profile: profile);
            }

            if (refreshTokenService == null)
            {
                refreshTokenService = CreateRefreshTokenService(
                    refreshTokenStore,
                    profile);
            }

            return(new TokenRequestValidator(
                       options,
                       authorizationCodeStore,
                       resourceOwnerValidator,
                       profile,
                       deviceCodeValidator,
                       aggregateExtensionGrantValidator,
                       customRequestValidator,
                       resourceValidator,
                       resourceStore,
                       tokenValidator,
                       refreshTokenService,
                       new TestEventService(),
                       new StubClock(),
                       TestLogger.Create <TokenRequestValidator>()));
        }
Example #35
0
 public ConsentService(IIdentityServerInteractionService interaction, IClientStore clientStore, IResourceStore resourceStore, ILogger logger)
 {
     _interaction   = interaction;
     _clientStore   = clientStore;
     _resourceStore = resourceStore;
     _logger        = logger;
 }
			public bool Authenticate(IResourceStore currentStore, string username, string password, out string[] allowedDatabases)
			{
				allowedDatabases = new[] { "*" };
				return string.IsNullOrEmpty(password) == false;
			}
Example #37
0
 public AndroidTextureLoaderStore(IResourceStore <byte[]> store)
     : base(store)
 {
 }
Example #38
0
		protected HttpServer(IRavenHttpConfiguration configuration, IResourceStore resourceStore)
		{
			DefaultResourceStore = resourceStore;
			DefaultConfiguration = configuration;

			configuration.Container.SatisfyImportsOnce(this);

			foreach (var responder in RequestResponders)
			{
				responder.Value.Initialize(() => currentDatabase.Value, () => currentConfiguration.Value, () => currentTenantId.Value, this);
			}

			switch (configuration.AuthenticationMode.ToLowerInvariant())
			{
				case "windows":
					requestAuthorizer = new WindowsRequestAuthorizer();
					break;
				case "oauth":
					requestAuthorizer = new OAuthRequestAuthorizer();
					break;
				default:
					throw new InvalidOperationException(
						string.Format("Unknown AuthenticationMode {0}. Options are Windows and OAuth", configuration.AuthenticationMode));
			}

			requestAuthorizer.Initialize(() => currentDatabase.Value, () => currentConfiguration.Value, () => currentTenantId.Value, this);
		}
Example #39
0
 public ScopeValidator(IResourceStore store, ILogger <ScopeValidator> logger)
 {
     _logger = logger;
     _store  = store;
 }
        /// <summary>
        /// Gets all enabled resources.
        /// </summary>
        /// <param name="store">The store.</param>
        /// <returns></returns>
        public static async Task <Resources> GetAllEnabledResourcesAsync(this IResourceStore store)
        {
            var resources = await store.GetAllResources();

            return(resources.FilterEnabled());
        }
Example #41
0
 public QueuesHttpServer(IRaveHttpnConfiguration configuration, IResourceStore resourceStore)
     : base(configuration, resourceStore)
 {
 }
Example #42
0
 public RoleStoreBuilder(IResourceStore resourceStore)
 {
     ResourceStore = resourceStore;
     RoleList      = new List <Role>();
 }
 /// <summary>
 /// Finds the enabled identity resources by scope.
 /// </summary>
 /// <param name="store">The store.</param>
 /// <param name="scopeNames">The scope names.</param>
 /// <returns></returns>
 public static async Task <IEnumerable <IdentityResource> > FindEnabledIdentityResourcesByScopeAsync(this IResourceStore store, IEnumerable <string> scopeNames)
 {
     return((await store.FindIdentityResourcesByScopeAsync(scopeNames)).Where(x => x.Enabled).ToArray());
 }
Example #44
0
 public IResourceStore <TextureUpload> CreateTextureLoaderStore(IResourceStore <byte[]> underlyingStore) => null;
Example #45
0
 /// <summary>
 /// Initializes a resource store with a single store.
 /// </summary>
 /// <param name="store">The store.</param>
 public ResourceStore(IResourceStore <T> store)
 {
     AddStore(store);
 }
Example #46
0
 public TestResourceProvider(IResourceStore <TextureUpload> textureStore)
 {
     this.textureStore = textureStore;
 }
Example #47
0
		protected abstract bool TryGetOrCreateResourceStore(string name, out IResourceStore database);
Example #48
0
 /// <summary>
 /// Adds a resource store to this store.
 /// </summary>
 /// <param name="store">The store to add.</param>
 public virtual void AddStore(IResourceStore <T> store)
 {
     stores.Add(store);
 }
Example #49
0
		public RavenDbHttpServer(IRavenHttpConfiguration configuration, IResourceStore database)
			: base(configuration, database)
		{
			RemoveTenantDatabase.Occured.Subscribe(TenantDatabaseRemoved);
		}
Example #50
0
 /// <summary>
 /// Removes a store from this store.
 /// </summary>
 /// <param name="store">The store to remove.</param>
 public virtual void RemoveStore(IResourceStore <T> store)
 {
     stores.Remove(store);
 }