Beispiel #1
0
        public static void AddWaf(
            this IServiceCollection services,
            WafHostEnum wafHost,
            AssemblyName[] appActionAssemblyNames,
            AssemblyName[] appManagerAssemblyNames)
        {
            // memory cache
            services.AddMemoryCache();

            // register managers
            var managerRegistrar = new WafManagerRegistrar();

            services.AddSingleton <WafManagerRegistrar>(managerRegistrar);
            managerRegistrar.InitializeManagers(services, appManagerAssemblyNames);

            // register actions
            var actionProcessor = new WafActionProcessor();

            services.AddSingleton <WafActionProcessor>(actionProcessor);

            actionProcessor.InitializeActions(services, appActionAssemblyNames);

            if (wafHost == WafHostEnum.Web)
            {
                // current user
                services.AddCurrentUserForWebHost();

                // routing services for web API
                var actionWebProcessor = new WafActionWebProcessor(actionProcessor);
                services.AddSingleton <WafActionWebProcessor>(actionWebProcessor);
                actionWebProcessor.AddRouting(services);
            }
        }
Beispiel #2
0
        public WafActionWebProcessor(WafActionProcessor wafActionProcessor)
        {
            Assure.ArgumentNotNull(wafActionProcessor, nameof(wafActionProcessor));

            _wafActionProcessor = wafActionProcessor;
        }