public BaseItemQueryHandler(PathService pathService, APIConnection connection, ManagerConfiguration managerConfiguration, FileService fileService)
 {
     this.connection           = connection;
     this.ManagerConfiguration = managerConfiguration;
     this.pathService          = pathService;
     this.fileService          = fileService;
 }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add catalog db context
            EFConfiguration.ConfigureService(services, Configuration);

            // IOC containers / Entity Framework
            StationeryConfiguration.ConfigureService(services);
            CatalogConfiguration.ConfigureService(services);

            // config connections options
            ConfigurationOptions.ConfigureService(services, this.Configuration);

            ManagerConfiguration.ConfigureService(services);

            // config jwtfactory and authenticatioin
            this.ConfigAuthentication(services);

            // Add framework services.
            services.AddLogging();
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            services.AddMvc().AddJsonOptions(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
Beispiel #3
0
 public JobPurgeTimer(RetryPolicyProvider retryPolicyProvider, ManagerConfiguration managerConfiguration) : base(managerConfiguration.PurgeJobsIntervalHours * 60 * 60 * 1000)
 {
     _managerConfiguration = managerConfiguration;
     _retryPolicy          = retryPolicyProvider.GetPolicy();
     _connectionString     = managerConfiguration.ConnectionString;
     Elapsed += PurgeTimer_elapsed;
 }
Beispiel #4
0
 public LEOUploadModule(APIConnection connection, APIConnection priveligedConnection, ManagerConfiguration managerConfiguration, MetadataAuditLogStore auditLogStore)
 {
     this.connection           = connection;
     this.managerConfiguration = managerConfiguration;
     // This privieged connection allows us to do things like add a user.
     this.privilegedConnection = priveligedConnection;
     this.auditLogStore        = auditLogStore;
 }
Beispiel #5
0
		public JobPurgeTimer(RetryPolicyProvider retryPolicyProvider, ManagerConfiguration managerConfiguration) : base(managerConfiguration.PurgeJobsIntervalHours*60*60*1000)
		{
			_managerConfiguration = managerConfiguration;
			_retryPolicy = retryPolicyProvider.GetPolicy();
			_connectionString = managerConfiguration.ConnectionString;
			Elapsed += PurgeTimer_elapsed;
			Purge();
		}
Beispiel #6
0
 public LEOUserItemQueryHandler(
     PathService pathService,
     APIConnection connection,
     IAuditLogStore auditLogStore, LEOUploadModule leoUploadModule, ManagerConfiguration managerConfiguration, FileService fileService) : base(pathService, connection, managerConfiguration, fileService)
 {
     this.auditLogStore        = auditLogStore;
     this.LEOUploadModule      = leoUploadModule;
     this.ManagerConfiguration = managerConfiguration;
 }
Beispiel #7
0
 public APIConnection(
     ILogger <APIConnection> logger,
     IHttpContextAccessor contextAccessor,
     ManagerConfiguration managerConfiguration
     ) : base(new Uri(managerConfiguration.API.Uri))
 {
     this.Logger = logger;
     this.Token  = contextAccessor.HttpContext.Request.Cookies[JWT_TOKEN_LOCATION];
     this.httpContextAccessor = contextAccessor;
 }
Beispiel #8
0
        public void SetUp()
        {
            ContainerBuilder containerBuilder = new ContainerBuilder();

            ManagerConfiguration config = new ManagerConfiguration(
                ConfigurationManager.ConnectionStrings["ManagerConnectionString"].ConnectionString, "Route", 60, 20, 1, 1, 1, 1);

            containerBuilder.RegisterModule(new ManagerModule(config));
            _container = containerBuilder.Build();
        }
Beispiel #9
0
        public EDiscovery(APIConnection connection, APIConnection priveligedConnection, ManagerConfiguration managerConfiguration, MetadataAuditLogStore auditLogStore)
        {
            this.connection           = connection;
            this.managerConfiguration = managerConfiguration;
            // This priveleged connection is used specifically when we're upgrading to the edisc credentials.  We really don't want anything else
            // in the pipeline to be able to use this.  So to be safe we're creating a seperate connection in this case.
            this.privilegedConnection = priveligedConnection;

            this.auditLogStore = auditLogStore;
        }
 public LogReaderQueryHandler(
     PathService pathService,
     APIConnection connection,
     ManagerConfiguration managerConfiguration,
     FileService fileService,
     LogReaderService logReaderService
     ) : base(pathService, connection, managerConfiguration, fileService)
 {
     this.ManagerConfiguration = managerConfiguration;
     this.LogReaderService     = logReaderService;
 }
Beispiel #11
0
 public JWTAuthController(
     ManagerConfiguration managerConfiguration,
     APIConnection connection,
     SSOJWTAuthentication ssoJWTAuthentication,
     ILogger <JWTAuthController> logger
     )
 {
     ManagerConfiguration = managerConfiguration;
     Connection           = connection;
     SSOJWTAuthentication = ssoJWTAuthentication;
     Logger = logger;
 }
Beispiel #12
0
 public LogReaderModule(
     APIConnection connection,
     APIConnection priveligedConnection,
     ManagerConfiguration managerConfiguration,
     LogReaderService logReaderService
     )
 {
     this.connection           = connection;
     this.managerConfiguration = managerConfiguration;
     // This privieged connection allows us to do things like add a user.
     this.privilegedConnection = priveligedConnection;
     this.logReaderService     = logReaderService;
 }
Beispiel #13
0
 public PathService(
     APIConnection connection,
     MetadataAuditLogStore auditLogStore,
     ViewSetService viewSetService,
     ModuleConfigurator moduleConfigurator,
     ManagerConfiguration managerConfiguration,
     FileService fileService
     ) : base(connection)
 {
     this.auditLogStore        = auditLogStore;
     this.viewSetService       = viewSetService;
     this.moduleConfigurator   = moduleConfigurator;
     this.ManagerConfiguration = managerConfiguration;
     this.fileService          = fileService;
 }
Beispiel #14
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext <ApplicationDbContext>(options =>
            {
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), option => option.MigrationsAssembly("TODOApp.DataAccessLayer"));
            });
            services.AddDefaultIdentity <ApplicationUser>()
            .AddUserManager <UserManagerExtended>()
            .AddEntityFrameworkStores <ApplicationDbContext>();

            services.AddMvc(setupAction =>
            {
                setupAction.EnableEndpointRouting = false;
                var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();

                setupAction.Filters.Add(new AuthorizeFilter(policy));
            }).AddJsonOptions(jsonOptions =>
            {                   // change camelCase Json results to PascalCase
                jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null;
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);



            services.AddRazorPages();

            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());


            services.AddKendo();

            RepositoryConfiguration.ConfigureServices(services);
            HostedServicesConfiguration.ConfigureServices(services);

            // managers
            ManagerConfiguration.ConfigureServices(services);

            // search criterias
            services.AddTransient <TodoItemSearchCriteria>();
            services.AddTransient <UserSearchCriteria>();
        }
        protected override void SetUp(ContainerBuilder builder)
        {
            ManagerConfiguration managerConfiguration = new ManagerConfiguration("connectionstring", "route", 60, 20, 1, 1, 1, 1);

            builder.RegisterInstance(managerConfiguration).As <ManagerConfiguration>().SingleInstance();
            builder.RegisterType <Validator>().SingleInstance();
            builder.RegisterType <FakeHttpSender>().As <IHttpSender>().SingleInstance().AsSelf();
            builder.Register(c => new FakeJobRepository()).As <IJobRepository>();
            builder.Register(c => new FakeWorkerNodeRepository()).As <IWorkerNodeRepository>();
            builder.RegisterApiControllers(typeof(ManagerController).Assembly);
            builder.RegisterType <JobManager>().SingleInstance();
            builder.RegisterType <NodeManager>().SingleInstance();
            builder.RegisterType <RetryPolicyProvider>().SingleInstance();
            builder.RegisterType <JobPurgeTimerFake>().As <JobPurgeTimer>().SingleInstance();
            builder.RegisterType <NodePurgeTimerFake>().As <NodePurgeTimer>().SingleInstance();
            builder.RegisterType <FakeLogger>().As <ILog>().SingleInstance();
        }
        public CmsManagerPackage(
            IHostingEnvironment hostingEnvironment,
            ITemplateBuilder templateBuilder,
            INameManager nameManager,
            IConfigurationStore configurationStore)
        {
            _templateBuilder = templateBuilder;
            _nameManager     = nameManager;

            Name             = "cms_manager";
            NamespaceName    = "cmsmanager";
            _resourceManager = new ResourceManager(hostingEnvironment, new MimeTypeEvaluator());

            _configNotification = configurationStore.Register(
                ManagerConfiguration.Path,
                c => _configuration = c.Sanitize(),
                new ManagerConfiguration());
        }
Beispiel #17
0
        protected override void SetUp(ContainerBuilder builder)
        {
            ManagerConfiguration config = new ManagerConfiguration(
                ConfigurationManager.ConnectionStrings["ManagerConnectionString"].ConnectionString, "Route", 60, 20, 10, 1, 24, 1);

            builder.RegisterInstance(config).SingleInstance();
            builder.RegisterType <RetryPolicyProvider>().SingleInstance();
            builder.RegisterType <HalfNodesAffinityPolicy>().SingleInstance();
            builder.RegisterType <JobManager>().SingleInstance();
            builder.RegisterType <TestHelper>().SingleInstance();

            builder.RegisterType <NodeManager>();

            builder.RegisterType <JobRepository>().As <IJobRepository>().SingleInstance();
            builder.RegisterType <JobRepositoryCommandExecuter>().SingleInstance();
            builder.RegisterType <WorkerNodeRepository>().As <IWorkerNodeRepository>().SingleInstance();

            builder.RegisterType <FakeHttpSender>().As <IHttpSender>().SingleInstance();
            builder.RegisterType <JobPurgeTimerFake>().As <JobPurgeTimer>().SingleInstance();
            builder.RegisterType <NodePurgeTimerFake>().As <NodePurgeTimer>().SingleInstance();
            builder.Register(c => new FakeLogger()).As <FakeLogger>().As <ILog>().SingleInstance();
        }
        public ActionResult SaveConfig(string tipo, string server, string user, string password, string database)
        {
            if (Session[HomeController.IdAdmin] == null)
            {
                return(RedirectToAction("Admin", "Home"));
            }
            DataBases db;

            if (Enum.TryParse(tipo, out db))
            {
                ManagerConfiguration.Save(db, server, user, password, database);
                ViewBag.IsValid = true;
                ViewBag.Mensaje = "Los cambios se guardaron correctamente.";
            }
            else
            {
                ViewBag.IsValid = false;
                ViewBag.Mensaje = "El tipo de Base de Datos no es aceptado";
            }

            ViewBag.IsSql = db == DataBases.SqlServer;
            return(View());
        }
Beispiel #19
0
        public override BaseItemQueryHandler GetInitialQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            if (identifier.PathKey == LOG_READER_PATH_KEY)
            {
                return(new LogReaderQueryHandler(pathService, connection, managerConfiguration, fileService, logReaderService));
            }

            return(null);
        }
Beispiel #20
0
        public static void Main(string[] args)
        {
            var configurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            XmlConfigurator.ConfigureAndWatch(new FileInfo(configurationFile));

            SetConsoleCtrlHandler(ConsoleCtrlCheck,
                                  true);

            var managerName = ConfigurationManager.AppSettings["ManagerName"];
            var baseAddress = new Uri(ConfigurationManager.AppSettings["baseAddress"]);

            var managerAddress = baseAddress.Scheme + "://+:" +
                                 baseAddress.Port + "/";

            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;


            WhoAmI =
                "[MANAGER CONSOLE HOST ( " + managerName + ", " + managerAddress + " )," + Environment.MachineName.ToUpper() + "]";

            Logger.InfoWithLineNumber(WhoAmI + " : started.");

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var managerConfiguration = new ManagerConfiguration(
                ConfigurationManager.ConnectionStrings["ManagerConnectionString"].ConnectionString,
                ConfigurationManager.AppSettings["route"],
                int.Parse(ConfigurationManager.AppSettings["AllowedNodeDownTimeSeconds"]),
                int.Parse(ConfigurationManager.AppSettings["CheckNewJobIntervalSeconds"]),
                int.Parse(ConfigurationManager.AppSettings["purgeJobsBatchSize"]),
                int.Parse(ConfigurationManager.AppSettings["purgeJobsIntervalHours"]),
                int.Parse(ConfigurationManager.AppSettings["PurgeJobsOlderThanHours"]),
                int.Parse(ConfigurationManager.AppSettings["PurgeNodesIntervalHours"]));

            var container = new ContainerBuilder().Build();
            var config    = new HttpConfiguration();

            using (WebApp.Start(managerAddress,
                                appBuilder =>
            {
                string owinListenerName = "Microsoft.Owin.Host.HttpListener.OwinHttpListener";
                OwinHttpListener owinListener = (OwinHttpListener)appBuilder.Properties[owinListenerName];

                int maxAccepts;
                int maxRequests;
                owinListener.GetRequestProcessingLimits(out maxAccepts, out maxRequests);

                owinListener.SetRequestQueueLimit(int.MaxValue);
                owinListener.SetRequestProcessingLimits(int.MaxValue, int.MaxValue);

                appBuilder.UseAutofacMiddleware(container);

                // Configure Web API for self-host.
                appBuilder.UseStardustManager(managerConfiguration,
                                              container);

                appBuilder.UseAutofacWebApi(config);
                appBuilder.UseWebApi(config);
            }))
            {
                Logger.InfoWithLineNumber(WhoAmI + ": Started listening on port : ( " + baseAddress + " )");

                QuitEvent.WaitOne();
            }
        }
Beispiel #21
0
 public EDiscoveryStagedItemQueryHandler(PathService pathService, APIConnection connection,
                                         ManagerConfiguration managerConfiguration, FileService fileService) : base(pathService, connection, managerConfiguration, fileService)
 {
     this.ManagerConfiguration = managerConfiguration;
 }
 public EDiscoveryController(ManagerConfiguration managerConfiguration, EDiscovery eDiscovery, APIConnection connection)
 {
     this.managerConfiguration = managerConfiguration;
     this.eDiscovery           = eDiscovery;
     this.connection           = connection;
 }
 // NYPTI's SSO system was originally SOAP-based
 // dotnet core didn't support SOAP-auth headers, hence an intermediate
 // JWT "service" was created which would receive the SOAP-style authentication
 // and hand it off to a JWT style service.  this decodes that JWT.
 public SSOJWTAuthentication(ManagerConfiguration managerConfiguration)
 {
     this.ManagerConfiguration = managerConfiguration;
 }
 public LEOUploadController(ManagerConfiguration managerConfiguration, LEOUploadModule leoUpload, APIConnection connection)
 {
     this.managerConfiguration = managerConfiguration;
     this.leoUpload            = leoUpload;
     this.connection           = connection;
 }
Beispiel #25
0
 public EDiscoveryRootQueryHandler(PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, EDiscovery eDiscovery, ManagerConfiguration managerConfiguration, FileService fileService) : base(pathService, connection, managerConfiguration, fileService)
 {
     this.auditLogStore        = auditLogStore;
     this.eDiscovery           = eDiscovery;
     this.ManagerConfiguration = managerConfiguration;
 }
Beispiel #26
0
        public override BaseItemQueryHandler GetInitialQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            // If the user is leo user, we're going to use a special query handler that
            // will return only the files the user is allowed to see.
            if (LEOUploadUtility.IsUserLeo(connection.UserAccessIdentifiers))
            {
                var userKey = connection.UserIdentifier.UserKey;

                // here we're going to do some basic security check.  The userKey has a folder key on it.  We need to make sure that matches.
                var userKeyTokens = userKey.Split(':').ToList();
                // now this will be an array, of tokens, keep in mind userkeys can be something like Defendant:18337980:[email protected], so we want everything before the last ':'
                // so we can remove the last token, and then we'll be able to just join back everything else.
                userKeyTokens.RemoveAt(userKeyTokens.Count - 1);
                // also get rid of the leo: prefix
                userKeyTokens.RemoveAt(0);
                var folderKeyFromUser = String.Join(':', userKeyTokens);
                if (folderKeyFromUser != identifier.FolderKey)
                {
                    throw (new UnauthorizedAccessException($"You're not authorized for this Folder userKey:{userKey} tried to access: {identifier.FolderKey}"));
                }

                return(new LEOUserItemQueryHandler(pathService, connection, auditLogStore, this, managerConfiguration, fileService));
            }

            if (identifier.PathKey == LEOUploadUtility.LEO_UPLOAD_PATH_KEY)
            {
                return(new LEOUploadRootQueryHandler(pathService, connection, auditLogStore, this, managerConfiguration, fileService));
            }

            return(null);
        }
Beispiel #27
0
 public EArraignment(APIConnection connection, ManagerConfiguration managerConfiguration)
 {
     this.connection           = connection;
     this.managerConfiguration = managerConfiguration;
 }
 public ConfigurationController(APIConnection apiConnection, ManagerConfiguration managerConfiguration)
 {
     this.APIConnection        = apiConnection;
     this.ManagerConfiguration = managerConfiguration;
 }
Beispiel #29
0
        public BaseItemQueryHandler GetActiveHandler(PathIdentifier identifier, List <IModule> activeModules, PathService pathService, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            var handler = new BaseItemQueryHandler(pathService, connection, managerConfiguration, fileService);

            foreach (var module in activeModules)
            {
                var initalHandler = module.GetInitialQueryHandler(identifier, pathService, connection, auditLogStore, managerConfiguration, fileService);
                if (initalHandler != null)
                {
                    handler = initalHandler;
                }
            }

            foreach (var module in activeModules)
            {
                var overrideHandler = module.GetOverrideQueryHandler(identifier, pathService, connection, auditLogStore, managerConfiguration, fileService);
                if (overrideHandler != null)
                {
                    handler = overrideHandler;
                }
            }

            return(handler);
        }
Beispiel #30
0
 public HomeController(ManagerConfiguration managerConfiguration)
 {
     this.managerConfiguration = managerConfiguration;
 }
Beispiel #31
0
 public JobPurgeTimerFake(RetryPolicyProvider retryPolicyProvider, ManagerConfiguration managerConfiguration) : base(retryPolicyProvider, managerConfiguration)
 {
 }