Esempio n. 1
0
        public IoTHubSink(SubscriptionMetadata metadata, ILog logger = null)
            : base(metadata, logger)
        {
            auditor = AuditFactory.CreateSingleton().GetAuditor(AuditType.Message);
            uri     = new Uri(metadata.NotifyAddress);
            NameValueCollection nvc = HttpUtility.ParseQueryString(uri.Query);
            string keyName          = nvc["keyname"];

            deviceId      = nvc["deviceid"];
            methodName    = nvc["method"];
            propertyName  = nvc["propname"];
            propertyValue = nvc["propvalue"];

            if (string.IsNullOrEmpty(methodName))
            {
                deviceClient = DeviceClient.CreateFromConnectionString(string.Format(
                                                                           "HostName={0};DeviceId={1};SharedAccessKey={2}", uri.Authority, deviceId, metadata.SymmetricKey));
            }
            else
            {
                serviceClient = ServiceClient.CreateFromConnectionString(string.Format(
                                                                             "HostName={0};SharedAccessKeyName={1};SharedAccessKey={2}", uri.Authority, keyName,
                                                                             metadata.SymmetricKey));
            }
        }
Esempio n. 2
0
        public override void Init()
        {
            Trace.TraceInformation("{0} - MQTT Protocol Adapter intialization on Channel '{1}'.", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), Channel.Id);

            auditFactory = AuditFactory.CreateSingleton();
            if (config.AuditConnectionString != null && config.AuditConnectionString.Contains("DefaultEndpointsProtocol"))
            {
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "messageaudit"), AuditType.Message);
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "useraudit"), AuditType.User);
            }
            else if (config.AuditConnectionString != null)
            {
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.Message);
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.User);
            }

            messageAuditor = auditFactory.GetAuditor(AuditType.Message);
            userAuditor    = auditFactory.GetAuditor(AuditType.User);

            forcePerReceiveAuthn   = Channel as UdpChannel != null;
            session.OnPublish     += Session_OnPublish;
            session.OnSubscribe   += Session_OnSubscribe;
            session.OnUnsubscribe += Session_OnUnsubscribe;
            session.OnDisconnect  += Session_OnDisconnect;;
            session.OnConnect     += Session_OnConnect;
            logger?.LogInformation($"MQTT adpater on channel '{Channel.Id}' is initialized.");
        }
Esempio n. 3
0
        public EventGridSink(SubscriptionMetadata metadata)
            : base(metadata)
        {
            auditor = AuditFactory.CreateSingleton().GetAuditor(AuditType.Message);
            uri     = new Uri(metadata.NotifyAddress);
            NameValueCollection nvc = HttpUtility.ParseQueryString(uri.Query);

            topicHostname = uri.Authority;
            topicKey      = metadata.SymmetricKey;
            string uriString = new Uri(metadata.SubscriptionUriString).ToString();

            resourceUriString = uriString.Replace("/" + uri.Segments[uri.Segments.Length - 1], "");
            if (!int.TryParse(nvc["clients"], out clientCount))
            {
                clientCount = 1;
            }

            ServiceClientCredentials credentials = new TopicCredentials(topicKey);

            clients = new EventGridClient[clientCount];
            for (int i = 0; i < clientCount; i++)
            {
                clients[i] = new EventGridClient(credentials);
            }
        }
Esempio n. 4
0
        public override void Init()
        {
            auditFactory = AuditFactory.CreateSingleton();
            if (config.AuditConnectionString != null &&
                config.AuditConnectionString.Contains("DefaultEndpointsProtocol"))
            {
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "messageaudit"),
                                 AuditType.Message);
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "useraudit"), AuditType.User);
            }
            else if (config.AuditConnectionString != null)
            {
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.Message);
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.User);
            }

            messageAuditor = auditFactory.GetAuditor(AuditType.Message);
            userAuditor    = auditFactory.GetAuditor(AuditType.User);
            logger?.LogDebugAsync("MQTT adapter audit factory added.").GetAwaiter();

            forcePerReceiveAuthn   = Channel as UdpChannel != null;
            session.OnPublish     += Session_OnPublish;
            session.OnSubscribe   += Session_OnSubscribe;
            session.OnUnsubscribe += Session_OnUnsubscribe;
            session.OnDisconnect  += Session_OnDisconnect;
            ;
            session.OnConnect += Session_OnConnect;
            logger?.LogInformationAsync($"MQTT adpater on channel '{Channel.Id}' is initialized.").GetAwaiter();
        }
 public static ClientConnection Connection(MetlConfiguration config,Credentials creds,IAuditor auditor)
 {
     return auditor.wrapFunction(((auditAction) =>
     {
         var webCreds = new NetworkCredential(creds.name, creds.password);
         auditAction(GaugeStatus.InProgress,7);
         //var jabberCreds = new Credentials(config.xmppUsername, config.xmppPassword,new List<AuthorizedGroup>(),"");
         var wcf = new WebClientFactory(webCreds,auditor,creds);
         auditAction(GaugeStatus.InProgress,14);
         var receiveEvents = new ProductionReceiveEvents(auditor);
         auditAction(GaugeStatus.InProgress,21);
         var authProvider = new AuthorisationProvider(wcf, config,auditor);
         auditAction(GaugeStatus.InProgress,28);
         var httpProvider = new HttpResourceProvider(wcf,auditor);
         auditAction(GaugeStatus.InProgress,35);
         var resourceUploaderFactory = new ProductionResourceUploaderFactory(config, httpProvider,auditor);
         auditAction(GaugeStatus.InProgress,42);
         var resourceUploader = resourceUploaderFactory.get();
         auditAction(GaugeStatus.InProgress,49);
         var resourceCache = new ResourceCache();
         auditAction(GaugeStatus.InProgress,56);
         var configurationProvider = new ConfigurationProvider(wcf,auditor);
         auditAction(GaugeStatus.InProgress,63);
         auditAction(GaugeStatus.InProgress,70);
         var jabberWireFactory = new JabberWireFactory(config, creds, configurationProvider,resourceUploader,resourceCache, receiveEvents, wcf, httpProvider,auditor);
         auditAction(GaugeStatus.InProgress,77);
         var userOptionsProvider = new UserOptionsProvider(config, httpProvider, resourceUploader);
         auditAction(GaugeStatus.InProgress,84);
         var cc = new ClientConnection(config, receiveEvents, authProvider, resourceUploader, jabberWireFactory.conversationDetailsProvider, resourceCache, jabberWireFactory, wcf, userOptionsProvider, httpProvider,auditor);
         auditAction(GaugeStatus.InProgress, 91);
         return cc;
     }), "create client connection", "backend");
 }
 public XmlSnippetsRedeployer(IAuditor auditor, Directories directories, FileInfo snippets, FileInfo script)
 {
     this.Auditor     = auditor;
     this.Directories = directories;
     this.Snippets    = snippets;
     this.Script      = script;
 }
Esempio n. 7
0
        public RedisSink(SubscriptionMetadata metadata, ILog logger = null)
            : base(metadata, logger)
        {
            tqueue = new TaskQueue();
            cqm    = new ConcurrentQueueManager();

            auditor = AuditFactory.CreateSingleton().GetAuditor(AuditType.Message);

            uri = new Uri(metadata.NotifyAddress);

            connectionString = $"{uri.Authority}:6380,password={metadata.SymmetricKey},ssl=True,abortConnect=False";

            NameValueCollection nvc = HttpUtility.ParseQueryString(uri.Query);

            if (!int.TryParse(nvc["db"], out dbNumber))
            {
                dbNumber = -1;
            }

            if (TimeSpan.TryParse(nvc["expiry"], out TimeSpan expiration))
            {
                expiry = expiration;
            }

            if (string.IsNullOrEmpty(metadata.ClaimKey))
            {
                cacheClaimType = metadata.ClaimKey;
            }

            connection = ConnectionMultiplexer.ConnectAsync(connectionString).GetAwaiter().GetResult();
            database   = connection.GetDatabase(dbNumber);
        }
        public void Initialize(IAuditor auditor)
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            m_Assemblies.Add(assemblies.First(a => a.Location.Contains("UnityEngine.dll")));
            m_Assemblies.Add(assemblies.First(a => a.Location.Contains("UnityEditor.dll")));

            // UnityEditor
            m_ProjectSettingsMapping.Add(new KeyValuePair <string, string>("UnityEditor.PlayerSettings",
                                                                           "Project/Player"));
            m_ProjectSettingsMapping.Add(
                new KeyValuePair <string, string>("UnityEditor.Rendering.EditorGraphicsSettings", "Project/Graphics"));

            // UnityEngine
            m_ProjectSettingsMapping.Add(new KeyValuePair <string, string>("UnityEngine.Physics", "Project/Physics"));
            m_ProjectSettingsMapping.Add(
                new KeyValuePair <string, string>("UnityEngine.Physics2D", "Project/Physics 2D"));
            m_ProjectSettingsMapping.Add(new KeyValuePair <string, string>("UnityEngine.Time", "Project/Time"));
            m_ProjectSettingsMapping.Add(new KeyValuePair <string, string>("UnityEngine.QualitySettings",
                                                                           "Project/Quality"));

            m_ProblemDescriptors = ProblemDescriptorLoader.LoadFromJson(ProjectAuditor.DataPath, "ProjectSettings");
            foreach (var descriptor in m_ProblemDescriptors)
            {
                auditor.RegisterDescriptor(descriptor);
            }
        }
Esempio n. 9
0
        public AzureQueueStorageSink(SubscriptionMetadata metadata, ILog logger = null)
            : base(metadata, logger)
        {
            loadQueue = new ConcurrentQueue <EventMessage>();

            auditor = AuditFactory.CreateSingleton().GetAuditor(AuditType.Message);
            uri     = new Uri(metadata.NotifyAddress);
            NameValueCollection nvc = HttpUtility.ParseQueryString(uri.Query);

            queue = nvc["queue"];

            string ttlString = nvc["ttl"];

            if (!string.IsNullOrEmpty(ttlString))
            {
                ttl = TimeSpan.Parse(ttlString);
            }

            Uri.TryCreate(metadata.SymmetricKey, UriKind.Absolute, out Uri sasUri);

            if (sasUri == null)
            {
                storage = QueueStorage.New(
                    $"DefaultEndpointsProtocol=https;AccountName={uri.Authority.Split(new[] { '.' })[0]};AccountKey={metadata.SymmetricKey};",
                    10000, 1000);
            }
            else
            {
                string connectionString = $"BlobEndpoint={queue};SharedAccessSignature={metadata.SymmetricKey}";
                storage = QueueStorage.New(connectionString, 1000, 5120000);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Invokes a given function and provides error handling and auditing in case the method causes
        /// an exception.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="auditor"></param>
        /// <param name="context"></param>
        /// <param name="func"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public static T SecureFunc <T>(IAuditor auditor, FileSystemTask context, Func <T> func, Func <string> errorMessage)
        {
            try
            {
                return(func());
            }
//      catch (FaultException<ResourceFault> e)
//      {
//        throw; //TODO provide implementation
//      }
//      catch (FaultException e)
//      {
//        //unwrap exception details
//        throw; //TODO provide implementation
//      }
//      catch (CommunicationException e)
//      {
//        throw; //TODO provide implementation
//      }
            catch (VfsException e)
            {
                //just audit and rethrow VFS exceptions
                auditor.AuditException(e, context);
                throw;
            }
            catch (Exception e)
            {
                //wrap unhandled exception into VFS exception
                var exception = new ResourceAccessException(errorMessage(), e);
                auditor.AuditException(exception, context);
                throw exception;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Invokes a given function and provides error handling and auditing in case the method causes
        /// an exception.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="auditor"></param>
        /// <param name="context"></param>
        /// <param name="func"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public static T SecureFunc <T>(IAuditor auditor, FileSystemTask context, Func <T> func, Func <string> errorMessage)
        {
            try
            {
                return(func());
            }
            catch (VfsFaultException e)
            {
                //audit as warning - the error has been properly handled by the service
                VfsFault fault = e.Fault;
                auditor.AuditException(e, AuditLevel.Warning, context, AuditEvent.Unknown, fault.CreateFaultMessage());

                //create a matching exception based on the fault type
                throw fault.ToException();
            }
            catch (VfsException e)
            {
                //just audit and rethrow VFS exceptions
                auditor.AuditException(e, context);
                throw;
            }
            catch (Exception e)
            {
                //wrap unhandled exception into VFS exception
                var exception = new ResourceAccessException(errorMessage(), e);
                auditor.AuditException(exception, context);
                throw exception;
            }
        }
Esempio n. 12
0
        public static Option <Directories> TryCreateDestinationIn(IAuditor auditor, DirectoryInfo destination, DirectoryInfo source)
        {
            int repeats   = 10;
            int pauseMsec = 100;

            while (repeats > 0)
            {
                try
                {
                    if (TryCreate(destination) is Some <DirectoryInfo> created)
                    {
                        Empty(created);
                        return(new Directories(source, created));
                    }
                    repeats -= 1;
                    Thread.Sleep(pauseMsec);
                }
                catch (Exception ex)
                {
                    auditor.FailedToCreateDestination(ex.Message);
                    return(None.Value);
                }
            }

            return(None.Value);
        }
Esempio n. 13
0
 public ClientController(IEligibilityService eligibilityService, IQuestionRepository questionRepository, IEmailService emailService, IAuditor auditor, IUser currentUser)
 {
     this._eligibilityService = eligibilityService;
     this._questionRepository = questionRepository;
     _emailService            = emailService;
     _auditor     = auditor;
     _currentUser = currentUser;
 }
Esempio n. 14
0
 public IndexModel(tt_apps_srs_db_context db,
                   IClientProvider clientProvider,
                   IAuditor auditor)
 {
     _db             = db;
     _clientProvider = clientProvider;
     _auditor        = auditor;
 }
 public AttorneyController(IEmailService emailService, ISecurityService security, IRepositoryFactory repositories, IUser currentUser, IAuditor auditor)
 {
     _emailService = emailService;
     _security = security;
     _repositories = repositories;
     _currentUser = currentUser;
     _auditor = auditor;
 }
Esempio n. 16
0
 public ClientController(IEligibilityService eligibilityService, IQuestionRepository questionRepository, IEmailService emailService, IAuditor auditor, IUser currentUser)
 {
     this._eligibilityService = eligibilityService;
     this._questionRepository = questionRepository;
     _emailService = emailService;
     _auditor = auditor;
     _currentUser = currentUser;
 }
 public AttorneyController(IEmailService emailService, ISecurityService security, IRepositoryFactory repositories, IUser currentUser, IAuditor auditor)
 {
     _emailService = emailService;
     _security     = security;
     _repositories = repositories;
     _currentUser  = currentUser;
     _auditor      = auditor;
 }
Esempio n. 18
0
        public WebHookSink(SubscriptionMetadata metadata, ILog logger)
            : base(metadata, logger)
        {
            this.logger = logger;
            auditor     = AuditFactory.CreateSingleton().GetAuditor(AuditType.Message);

            address = new Uri(metadata.NotifyAddress).ToString();
        }
Esempio n. 19
0
        /// <summary>
        /// Initialize Objects
        /// </summary>
        private void InitializeObjects()
        {
            IConfiguration configuration = (AzureConfig)Utils.Configuration;

            this.DbSyncManager = configuration.CurrentContainer.Resolve <IDBSyncManager>();
            this.Logger        = configuration.CurrentContainer.Resolve <ILogger>();
            this.Auditor       = configuration.CurrentContainer.Resolve <IAuditor>();
        }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PipelineArgument"/> class.
 /// </summary>
 public PipelineArgument(IReadOnlyDictionary <string, string> propertyBag, IDocument document, IRuleSet rules,
                         IPipelineMember successor, IAuditor auditor)
 {
     PropertyBag = propertyBag;
     Document    = document;
     Rules       = rules;
     Successor   = successor;
     Auditor     = auditor;
 }
Esempio n. 21
0
        public void Initialize(LunaSettingsProvider settingsProvider)
        {
            MembershipProvider = new MembershipProvider();
            DatabaseProvider = new DatabaseProvider();
            SettingsProvider = settingsProvider;
            Auditor = new Auditor();

            base.Initialize(null, new CacheProvider(), DatabaseProvider, null, null);
        }
Esempio n. 22
0
 public static void WriteSuccess(IAuditor auditor, ApiOperationContext context)
 {
     auditor.Write(new AuditItem(
                       Activity.Current?.Id ?? "no-activity-id",
                       true,
                       "Success",
                       GetUserId(context),
                       context.Operation));
 }
Esempio n. 23
0
        /// <summary>
        /// Unregisters a specific auditor.
        /// <para />
        /// If the auditor is not registered, nothing happens.
        /// </summary>
        /// <exception cref="ArgumentNullException">The <paramref name="auditor"/> is <c>null</c>.</exception>
        public static void UnregisterAuditor(IAuditor auditor)
        {
            Argument.IsNotNull("auditor", auditor);

            lock (_instance._auditors)
            {
                _instance._auditors.Remove(auditor);
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Migration"/> class.
 /// </summary>
 /// <param name="connectionFactory">The connection factory.</param>
 /// <param name="scriptExecutor">The script executor.</param>
 /// <param name="auditLog">The audit log.</param>
 /// <param name="batchManager">The script batch manager.</param>
 /// <param name="initializationScriptProvider">The script provider for scripts to run when initializing the database.</param>
 /// <param name="migrationScriptProvider">The script provider for scripts to run during migrations.</param>
 internal Migration(IConnectionFactory connectionFactory, IScriptExecutor scriptExecutor, IAuditor auditLog, IBatchManager batchManager, IScriptProvider initializationScriptProvider, IScriptProvider migrationScriptProvider)
 {
     this.connectionFactory            = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
     this.scriptExecutor               = scriptExecutor ?? throw new ArgumentNullException(nameof(scriptExecutor));
     this.auditLog                     = auditLog ?? throw new ArgumentNullException(nameof(auditLog));
     this.batchManager                 = batchManager ?? throw new ArgumentNullException(nameof(batchManager));
     this.initializationScriptProvider = initializationScriptProvider ?? throw new ArgumentNullException(nameof(initializationScriptProvider));
     this.migrationScriptProvider      = migrationScriptProvider ?? throw new ArgumentNullException(nameof(migrationScriptProvider));
 }
Esempio n. 25
0
        /// <summary>
        /// Unregisters a specific auditor.
        /// <para />
        /// If the auditor is not registered, nothing happens.
        /// </summary>
        /// <exception cref="ArgumentNullException">The <paramref name="auditor"/> is <c>null</c>.</exception>
        public static void UnregisterAuditor(IAuditor auditor)
        {
            Argument.IsNotNull("auditor", auditor);

            lock (_instance._auditors)
            {
                _instance._auditors.Remove(auditor);
            }
        }
Esempio n. 26
0
 public static void WriteFailure(IAuditor auditor, ApiOperationContext context, Exception e)
 {
     auditor.Write(new AuditItem(
                       Activity.Current?.Id ?? "no-activity-id",
                       false,
                       e.Message,
                       GetUserId(context),
                       context.Operation));
 }
Esempio n. 27
0
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("NotificationWorker entry point called");

            try
            {
                IUnityContainer container = Utils.Configuration.CurrentContainer;
                //TODO container.LoadConfiguration();


                container.RegisterType <IHttpClientManager, HttpClientManager>(
                    new PerThreadLifetimeManager(),
                    new InjectionConstructor(RoleEnvironment.GetConfigurationSettingValue("AuthorizationSchema")));

                container.RegisterType <IWhitespacesDataClient, WhitespacesDataClient>(
                    new InjectionConstructor(new ResolvedParameter <IHttpClientManager>()));

                this.auditNotificationSystem        = container.Resolve <NotificationSystem>("auditTracker");
                this.userRequestsNotificationSystem = container.Resolve <NotificationSystem>("userAccessRequestTracker");
                this.whitespacesManager             = container.Resolve <WhitespacesManager>();
                this.notificationAuditor            = container.Resolve <AzureAuditor>();
                this.notificationLogger             = container.Resolve <Logger>();

                while (true)
                {
                    if (!this.auditNotificationSystem.Enabled)
                    {
                        this.auditNotificationSystem.StartTracking();
                    }

                    if (!this.userRequestsNotificationSystem.Enabled)
                    {
                        this.userRequestsNotificationSystem.StartTracking();
                    }

                    this.MonitorGetChannelList();

                    Thread.Sleep(TimeSpan.FromMinutes(10));
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.TraceError(ex.ToString());

                if (this.auditNotificationSystem.Enabled)
                {
                    this.auditNotificationSystem.StopTracking();
                }

                if (!this.userRequestsNotificationSystem.Enabled)
                {
                    this.userRequestsNotificationSystem.StopTracking();
                }
            }
        }
Esempio n. 28
0
        protected BaseGateway(IAuditor auditor, string connectionString)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentNullException(nameof(connectionString));
            }

            Auditor          = auditor ?? throw new ArgumentNullException(nameof(auditor));
            ConnectionString = connectionString;
        }
Esempio n. 29
0
        /// <summary>
        /// Audits a request for a given file's meta data (e.g. through <see cref="IFileSystemProvider.GetFileInfo"/>.
        /// Be aware that this might cause verbose audit trails.
        /// </summary>
        public static void AuditFileInfoRequest(IAuditor auditor, FileSystemTask context, IVirtualFileItem file)
        {
            if (!AuditHelper.IsInfoEnabledFor(auditor, context))
            {
                return;
            }

            string msg = String.Format("File information requested:\n{0}", AuditHelper.CreateResourceInfoString(file));

            auditor.Audit(AuditLevel.Info, context, AuditEvent.FileInfoRequested, msg);
        }
Esempio n. 30
0
        public static void AuditDeniedFolderCreation(IAuditor auditor, AuditEvent eventId, IVirtualFolderItem folder)
        {
            if (!AuditHelper.IsWarnEnabledFor(auditor, FileSystemTask.FolderCreateRequest))
            {
                return;
            }

            string msg = String.Format("Blocked attempt to create folder on file system. Folder information:\n{0}", AuditHelper.CreateResourceInfoString(folder));

            auditor.Audit(AuditLevel.Warning, FileSystemTask.FolderCreateRequest, eventId, msg);
        }
Esempio n. 31
0
        /// <summary>
        /// Audits an attempt to delete the root folder.
        /// </summary>
        public static void AuditDeleteRootAttempt(IAuditor auditor, IVirtualFolderItem folder)
        {
            if (!AuditHelper.IsWarnEnabledFor(auditor, FileSystemTask.FolderDeleteRequest))
            {
                return;
            }

            string msg = String.Format("Blocked attempt to delete root folder.\n\n{0}", AuditHelper.CreateResourceInfoString(folder));

            auditor.Audit(AuditLevel.Warning, FileSystemTask.FolderDeleteRequest, AuditEvent.DeleteFileSystemRoot, msg);
        }
Esempio n. 32
0
        /// <summary>
        /// Audits a request for an unknown transfer.
        /// </summary>
        public static void AuditUnknownTransferRequest(IAuditor auditor, FileSystemTask context, string transferId)
        {
            if (!AuditHelper.IsWarnEnabledFor(auditor, context))
            {
                return;
            }

            string msg = String.Format("Request for unknown transfer [{0}] received.", transferId);

            auditor.Audit(AuditLevel.Warning, context, AuditEvent.UnknownTransferRequest, msg);
        }
Esempio n. 33
0
        /// <summary>
        /// Audits a request for the file system's root folder.
        /// </summary>
        public static void AuditRootFolderRequest(IAuditor auditor, IVirtualFolderItem rootFolder)
        {
            if (!AuditHelper.IsInfoEnabledFor(auditor, FileSystemTask.RootFolderInfoRequest))
            {
                return;
            }

            const string msg = "File system root requested.";

            auditor.Audit(AuditLevel.Info, FileSystemTask.RootFolderInfoRequest, AuditEvent.FolderInfoRequested, msg);
        }
Esempio n. 34
0
        private Option <Artifact> DeployNonEmpty(IAuditor auditor, Directories directories, FileInfo source, List <XmlSnippet> snippets, FileInfo destination)
        {
            if (!new SnippetsScriptWriter(destination).WriteIfModified(snippets))
            {
                return(None.Value);
            }

            XmlSnippetsRedeployer redeployer = new XmlSnippetsRedeployer(auditor, directories, source, destination);

            return(new TranslatedSnippetsScript(redeployer, source, destination));
        }
Esempio n. 35
0
        public static void SecureAction(IAuditor auditor, FileSystemTask context, Action action, Func <string> errorMessage)
        {
            //TODO replace wrapper once SecureFunc is properly implemented
            Func <bool> func = () =>
            {
                action();
                return(true);
            };

            SecureFunc(auditor, context, func, errorMessage);
        }
Esempio n. 36
0
        /// <summary>
        /// Registers a specific auditor.
        /// </summary>
        /// <param name="auditor">The auditor.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="auditor"/> is <c>null</c>.</exception>
        public static void RegisterAuditor(IAuditor auditor)
        {
            Argument.IsNotNull("auditor", auditor);

            lock (_instance._auditors)
            {
                if (!_instance._auditors.Contains(auditor))
                {
                    _instance._auditors.Add(auditor);
                }
            }
        }
 public ProductionProviderMonitor(
     MetlConfiguration _metlServerAddress,
     ITimerFactory _timerFactory,
     IReceiveEvents _receiveEvents,
     IWebClient _webCleint,
     IAuditor _auditor
     )
 {
     auditor = _auditor;
     metlServerAddress = _metlServerAddress;
     timerFactory = _timerFactory;
     client = _webCleint;
 }
Esempio n. 38
0
 public PrintParser(
     Credentials credentials,
     int room,
     MeTLLib.Providers.Structure.IConversationDetailsProvider conversationDetailsProvider,
     HttpHistoryProvider historyProvider,
     CachedHistoryProvider cachedHistoryProvider,
     MetlConfiguration metlServerAddress,
     ResourceCache cache,
     IReceiveEvents receiveEvents,
     IWebClientFactory webClientFactory,
     HttpResourceProvider httpResourceProvider,
     IAuditor _auditor)
     : base(credentials, room, conversationDetailsProvider, historyProvider, cachedHistoryProvider, metlServerAddress, cache, receiveEvents, webClientFactory, httpResourceProvider,_auditor)
 {
 }
        public AuditingProductRepository(
            ProductRepository repository,
            IAuditor auditor)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }
            if (auditor == null)
            {
                throw new ArgumentNullException("auditor");
            }        

            this.innerRepository = repository;
            this.auditor = auditor;
        }
 public MeTLXmppClientConnection(string domain, string server,IAuditor _auditor) : base()
 {
     auditor = _auditor;
     this.Server = domain;
     this.ConnectServer = server;
     this.SocketConnectionType = agsXMPP.Net.SocketConnectionType.Direct;
     this.UseStartTLS = true;
     this.UseSSL = false; // this should be set to false when UseStartTLS is set to true.  UseStartTLS should deprecate useSSL.
     this.AutoAgents = false;
     this.AutoResolveConnectServer = false;
     this.UseCompression = false;
     ClientSocket.OnError += (s, e) =>
     {
         auditor.error("ClientSocket Error","MeTLXmppClientConnection",e);
     };
 }
 public AuthorisationProvider(IWebClientFactory factory, MetlConfiguration server, IAuditor auditor)
     : base(factory,auditor)
 {
     this.webclientFactory = factory;
     this.server = server;
 }
 public ConfigurationProvider(IWebClientFactory factory,IAuditor auditor) : base(factory,auditor) {}
 public AuditManager(IAuditor defaultAuditor, params INamespaceAuditor[] namespaceAuditors) {
     this.defaultAuditor = defaultAuditor;
     this.namespaceAuditors = namespaceAuditors;
 }
Esempio n. 44
0
        //---------------------------------------------------
        //
        //  Agent Initialization
        //
        //---------------------------------------------------
        void Init(SmtpAgentSettings settings)
        {
            m_settings = settings;
            m_settings.Validate();

            m_auditor = IoC.Resolve<IAuditor>();
            m_logger = Log.For(this);

            m_diagnostics = new AgentDiagnostics(this);
            m_configService = new ConfigService(m_settings);
            m_monitorService = new MonitorService(m_settings);

            using (new MethodTracer(Logger))
            {
                try
                {
                    //
                    // First, setup defaults using Xml Config
                    //
                    this.InitDomains();
                    this.InitFolders();
                    this.InitRoutes();
                    this.InitNotifications();
                    //
                    // Call config service, if any was configured
                    //
                    this.InitDomainsFromConfigService();
                    //
                    // Finally, we can agent...
                    //
                    this.InitAgent();
                    this.SubscribeToAgentEvents();
                    this.ConfigureServicePoints();
                }
                catch (Exception ex)
                {
                    Logger.Error("While initializing {0}", ex.ToString());
                    throw;
                }
            }
        }
 public AuditInstaller(IAuditor defaultAuditor) {
     auditManager = new AuditManager(defaultAuditor);
 }
 public CustomerFinderImpl(IRepository repository, IAuditor auditor, IAuthorization authorization)
 {
     this.repository = repository;
     this.auditor = auditor;
     this.authorization = authorization;
 }
 /// <summary>
 /// </summary>
 /// <param name="defaultAuditor">This will be used unless the object is recognised by one of the namespaceAuthorizers</param>
 /// <param name="namespaceAuditors"></param>
 public AuditInstaller(IAuditor defaultAuditor, params INamespaceAuditor[] namespaceAuditors) {
     auditManager = new AuditManager(defaultAuditor, namespaceAuditors);
 }
 public ProductionResourceUploader(MetlConfiguration _metlServerAddress, HttpResourceProvider provider, IAuditor _auditor)
 {
     auditor = _auditor;
     metlServerAddress = _metlServerAddress;
     _httpResourceProvider = provider;
 }
 public AuditingProductRepository(ProductRepository repository, IAuditor auditor)
 {
     innerRepository = repository;
     this.auditor = auditor;
 }
 public MetlConfigurationManager(IAuditor _auditor)
 {
     auditor = _auditor;
     reload();
 }
 public RemoteAppMeTLConfigurationManager(IAuditor auditor) : base(auditor) { }
 public LocalAppMeTLConfigurationManager(IAuditor auditor) : base(auditor) { }
 public MeTLConfiguration(IAuditor _auditor)
 {
     auditor = _auditor;
 }
 public ProductionResourceUploaderFactory(MetlConfiguration _config, HttpResourceProvider _provider, IAuditor _auditor)
 {
     auditor = _auditor;
     provider = _provider;
     config = _config;
 }
Esempio n. 55
0
 public ProductionReceiveEvents(IAuditor _auditor)
 {
     auditor = _auditor;
     this.PresenceAvailable += (sender, args) => { } ;
     this.SlideCollectionUpdated += (sender, args) => { };
     this.ChatAvailable += (sender, args) => { };
     this.CommandAvailable += (sender, args) => { };
     this.ConversationDetailsAvailable += (sender, args) => { };
     this.DirtyAutoShapeAvailable += (sender, args) => { };
     this.DirtyImageAvailable += (sender, args) => { };
     this.DirtyLiveWindowAvailable += (sender, args) => { };
     this.DirtyStrokeAvailable += (sender, args) => { };
     this.DirtyTextBoxAvailable += (sender, args) => { };
     this.DirtyVideoAvailable += (sender, args) => { };
     this.DiscoAvailable += (sender, args) => { };
     this.FileAvailable += (sender, args) => { };
     this.ImageAvailable += (sender, args) => { };
     this.MoveDeltaAvailable += (sender, args) => { };
     this.LiveWindowAvailable += (sender, args) => { };
     this.PreParserAvailable += (sender, args) => { };
     this.QuizAnswerAvailable += (sender, args) => { };
     this.QuizQuestionAvailable += (sender, args) => { };
     this.StatusChanged += (sender,args) =>{ };
     this.StrokeAvailable += (sender, args) => { };
     this.SubmissionAvailable += (sender, args) => { };
     this.TextBoxAvailable += (sender, args) => { };
     this.TeacherStatusRequest += (sender, args) => { };
     this.TeacherStatusReceived += (sender, args)=> { };
     this.SyncMoveRequested += (sender, SyncMoveRequestedEventArgs) => { };
     this.AttendanceAvailable += (sender, args) => { };
     this.ServersDown += (sender, args) => { };
 }