コード例 #1
0
 public BatchDeleteQueueMessagesCommandHandler(
     ICosmosMessageDbContext cosmosDbContext,
     ServiceBusErrorManagementSettings serviceBusSettings,
     ILogger <BatchDeleteQueueMessagesCommandHandler> logger,
     IAuditService auditService)
 {
     _cosmosDbContext = cosmosDbContext;
     _batchSize       = serviceBusSettings.PeekMessageBatchSize;
     _logger          = logger;
     _auditService    = auditService;
 }
        public AsbService(IUserService userService,
                          ServiceBusErrorManagementSettings serviceBusSettings,
                          ILogger <AsbService> logger,
                          IServiceBusPolicies serviceBusPolicies)
        {
            _logger      = logger ?? throw new Exception("logger is null");
            _regexString = serviceBusSettings.QueueSelectionRegex;
            _userService = userService;
            _policies    = serviceBusPolicies;

            _sbConnectionStringBuilder = new ServiceBusConnectionStringBuilder(serviceBusSettings.ServiceBusConnectionString);
            _tokenProvider             = TokenProvider.CreateManagedIdentityTokenProvider();
            _managementClient          = _sbConnectionStringBuilder.HasSasKey()
                ? new ManagementClient(_sbConnectionStringBuilder) : new ManagementClient(_sbConnectionStringBuilder, _tokenProvider);
        }
コード例 #3
0
 public RetrieveMessagesService(
     ServiceBusErrorManagementSettings serviceBusSettings,
     ILogger <RetrieveMessagesService> logger,
     IBatchGetMessageStrategy batchMessageStrategy,
     IUserService userService,
     ICosmosMessageDbContext cosmosDbContext,
     IMessageReceiverFactory messageReceiverFactory
     )
 {
     _batchMessageStrategy = batchMessageStrategy;
     _logger                 = logger;
     _batchSize              = serviceBusSettings.PeekMessageBatchSize;
     _userService            = userService;
     _cosmosDbContext        = cosmosDbContext;
     _messageReceiverFactory = messageReceiverFactory;
 }
        public async Task ThenSensitiveInformationIsRedacted()
        {
            var tokens = new List <string>()
            {
                "(.*SharedAccessKey=)([A-Za-z0-9]+=)(.*)"
            };
            var values = new List <KeyValuePair <string, object> >();

            values.Add(new KeyValuePair <string, object>("Key1", "NotSensitive"));
            values.Add(new KeyValuePair <string, object>("Key2", "xyz;SharedAccessKey=12345qwerty="));

            var serviceBusSettings = new ServiceBusErrorManagementSettings
            {
                RedactPatterns = tokens.ToArray()
            };

            var redactor = new MessageDetailRedactor(serviceBusSettings);

            var result = redactor.Redact(values);

            result.Should().NotBeNull();
            result.Count(x => x.Value == "[REDACTED]").Should().Be(1);
            result.Count(x => x.Value == "NotSensitive").Should().Be(1);
        }
コード例 #5
0
 public MessageListController(
     IUserService userService,
     IQueryHandler <GetMessagesQuery, GetMessagesQueryResponse> getMessagesQuery,
     IQueryHandler <GetMessagesByIdQuery, GetMessagesByIdQueryResponse> getMessagesByIdQuery,
     IQueryHandler <GetQueueDetailsQuery, GetQueueDetailsQueryResponse> getQueueDetailsQuery,
     IMessageService messageService,
     IUserSessionService userSessionService,
     IOptions <ServiceBusErrorManagementSettings> settings,
     ICommandHandler <SendMessagesCommand, SendMessagesCommandResponse> sendMessagesCommand,
     ICommandHandler <BatchDeleteQueueMessagesCommand, BatchDeleteQueueMessagesCommandResponse> deleteQueueMessageCommand,
     IRetrieveMessagesService retrieveMessagesService,
     IQueryHandler <GetQueueMessageCountQuery, GetQueueMessageCountQueryResponse> getQueueMessageCountQuery)
 {
     _userService               = userService;
     _getMessagesQuery          = getMessagesQuery;
     _getMessagesByIdQuery      = getMessagesByIdQuery;
     _getQueueDetailsQuery      = getQueueDetailsQuery;
     _messageService            = messageService;
     _userSessionService        = userSessionService;
     _settings                  = settings.Value;
     _deleteQueueMessageCommand = deleteQueueMessageCommand;
     _retrieveMessagesService   = retrieveMessagesService;
     _getQueueMessageCountQuery = getQueueMessageCountQuery;
 }
コード例 #6
0
 public MessageReceiverFactory(ServiceBusErrorManagementSettings serviceBusSettings)
 {
     _sbConnectionStringBuilder = new ServiceBusConnectionStringBuilder(serviceBusSettings.ServiceBusConnectionString);
     _tokenProvider             = TokenProvider.CreateManagedIdentityTokenProvider();
 }
 public MessageDetailRedactor(ServiceBusErrorManagementSettings serviceBusSettings)
 {
     _tokens = serviceBusSettings.RedactPatterns;
 }