Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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;
 }
        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            // do something before the action executes
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            ActionExecutedContext resultContext = await next();//执行Action

            // do something after the action executes; resultContext.Result will be set
            stopwatch.Stop();
            if (!Ignore)
            {
                try
                {
                    AuditLogModel model = new AuditLogModel
                    {
                        CurrentUserId   = context.HttpContext.User.Identity.IsAuthenticated ? context.HttpContext.User.FindFirst("sub").Value : string.Empty,
                        Action          = context.ActionDescriptor.DisplayName.ToSubstring(127),
                        HttpMethod      = context.HttpContext.Request.Method,
                        IP              = HttpHelper.GetIP(context.HttpContext),
                        ExecuteDuration = (int)stopwatch.ElapsedMilliseconds,
                        ExecuteTime     = DateTime.Now,
                        Arguments       = context.ActionArguments.Count > 0 ? context.ActionArguments.ToJson().ToSubstring(1023) : string.Empty,
                        Exception       = resultContext.Exception?.Message.ToSubstring(127),
                        Result          = (resultContext.Result is JsonResult) ? (resultContext.Result as JsonResult).Value?.ToJson().ToSubstring(2047) : string.Empty
                    };
                    IAuditLogStore store = context.HttpContext.RequestServices.GetService <IAuditLogStore>();
                    await store.SaveAsync(model);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        public override BaseItemQueryHandler GetInitialQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
        {
            // If the user is an eDiscovery user, we're going to use a special query handler that will return only the files the user is allowed to see.
            if (EDiscoveryUtility.IsUserEDiscovery(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);
                var folderKeyFromUser = String.Join(':', userKeyTokens);
                if (folderKeyFromUser != identifier.FolderKey)
                {
                    throw (new UnauthorizedAccessException($"You're not authorized for this eDiscovery Folder userKey:{userKey} tried to access: {identifier.FolderKey}"));
                }

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

            if (identifier.PathKey == EDiscoveryUtility.E_DISCOVERY_PATH_KEY)
            {
                return(new EDiscoveryRootQueryHandler(pathService, connection, auditLogStore, this, managerConfiguration, fileService));
            }

            if (identifier.PathKey != null &&
                identifier.FullName.StartsWith(EDiscoveryUtility.E_DISCOVERY_NOT_SHARED_PATH_KEY))
            {
                return(new EDiscoveryStagedItemQueryHandler(pathService, connection, managerConfiguration, fileService));
            }

            if (identifier.PathKey != null &&
                (identifier.FullName.StartsWith(EDiscoveryUtility.E_DISCOVERY_DATED_PACKAGE_PATH_KEY) ||
                 identifier.FullName.StartsWith(EDiscoveryUtility.E_DISCOVERY_ALL_PACKAGE_PATH_KEY)))
            {
                return(new EDiscoveryDatedPackageItemQueryHandler(pathService, connection, managerConfiguration, fileService));
            }

            return(null);
        }
Ejemplo n.º 11
0
 public virtual BaseItemQueryHandler GetOverrideQueryHandler(PathIdentifier identifier, PathService pathService, APIConnection connection, IAuditLogStore auditLogStore, ManagerConfiguration managerConfiguration, FileService fileService)
 {
     return(null);
 }
Ejemplo n.º 12
0
 public AuthController(IAuthenticationService authenticationService, IJWTService jWTService, IAuditLogStore auditLogStore)
 {
     this._authenticationService = authenticationService;
     this._jWTService            = jWTService;
     this._auditLogStore         = auditLogStore;
 }