public MediaMalwareDetectionServiceConfiguration(IDiagnosticsTracingService diagnosticsTracingService, IAzureKeyVaultService keyVaultService)
        {
            var configuration = keyVaultService.GetObject <ScaniiHostConfiguration>();

            this.Key     = configuration.Key;
            this.Secret  = configuration.Secret;
            this.BaseUri = configuration.BaseUri;


            this.ScaniiClient = new ScaniiClient(diagnosticsTracingService,
                                                 configuration.Key,
                                                 configuration.Secret,
                                                 configuration.BaseUri);
        }
Beispiel #2
0
        public ScaniiClientTests()
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .MinimumLevel.Debug()
                         .CreateLogger();

            Log.Logger.Debug("ctor");

            if (Environment.GetEnvironmentVariable("SCANII_CREDS") != null)
            {
                // ReSharper disable once PossibleNullReferenceException
                var creds = Environment.GetEnvironmentVariable("SCANII_CREDS").Split(':');
                _key    = creds[0];
                _secret = creds[1];
            }

            _client = new ScaniiClient(_key, _secret);
            using (var output = new StreamWriter(_eicarFile))
            {
                output.WriteLine(Eicar);
            }
        }
Beispiel #3
0
        public void ShouldCreateAuthToken()
        {
            var token = _client.CreateAuthToken(5);

            Assert.NotNull(token.ResourceId);
            Assert.NotNull(token.CreationDate);
            Assert.NotNull(token.ExpirationDate);

            Log.Logger.Information("using auth token to create a new client...");

            var client2 = new ScaniiClient(ScaniiTarget.V21, token.ResourceId);

            Log.Logger.Information("using token to process content");

            var result = client2.Process(_eicarFile);

            Assert.NotNull(result.ResourceId);
            Assert.True(result.Findings.Contains(Finding));
            Assert.AreEqual(1, result.Findings.Count);
            Assert.AreEqual(_checksum, result.Checksum);
            Assert.NotNull(result.ContentLength);
            Assert.NotNull(result.CreationDate);
            Assert.NotNull(result.RawResponse);
        }