示例#1
0
        public Task SetConfiguration(IWorkContext context, IClientTokenManagerConfiguration clientTokenManagerConfiguration)
        {
            Verify.IsNotNull(nameof(clientTokenManagerConfiguration), clientTokenManagerConfiguration);
            Verify.Assert(clientTokenManagerConfiguration.TokenKey.Value == ActorKey.VectorKey, "Configuration does not match actor key");

            _clientTokenManagerConfiguration = clientTokenManagerConfiguration;

            _clientTokenManager = new ClientTokenManager(_certificateRepository, _clientTokenManagerConfiguration, _restClientConfiguration);
            return(Task.FromResult(0));
        }
示例#2
0
 /// <summary>
 /// Construtor padrão
 /// </summary>
 /// <param name="nextMiddlewareInPipelineDelegate"></param>
 /// <param name="tokenManager"></param>
 /// <param name="logger"></param>
 /// <param name="errorLogger"></param>
 /// <param name="translateOptions"></param>
 /// <param name="globalizationOptions"></param>
 /// <param name="memoryCache"></param>
 /// <param name="httpClientFactory"></param>
 public TranslationMiddleware(RequestDelegate nextMiddlewareInPipelineDelegate, IClientTokenManager tokenManager, ILogger <TranslationMiddleware> logger, IErrorLogger errorLogger, IOptions <TranslationOptions> translateOptions, IOptions <GlobalizationOptions> globalizationOptions, IMemoryCache memoryCache, IHttpClientFactory httpClientFactory)
 {
     this.nextMiddlewareInPipelineDelegate = nextMiddlewareInPipelineDelegate;
     this.tokenManager             = tokenManager;
     this.logger                   = logger;
     this.errorLogger              = errorLogger;
     this.translateOptions         = translateOptions?.Value ?? throw new ArgumentException("Translate options required.");
     this.globalizationOptions     = globalizationOptions?.Value ?? throw new ArgumentException("Globalization options required.");
     this.memoryCache              = memoryCache ?? throw new ArgumentException("IMemoryCache options required.");
     this.httpClientFactory        = httpClientFactory ?? throw new ArgumentException("IHttpClientFactory required.");
     recyclableMemoryStreamManager = new RecyclableMemoryStreamManager();
 }
示例#3
0
        public TokenClientActor(
            ActorKey actorKey,
            IActorManager actorManager,
            ICertificateRepository certificateRepository,
            IRestClientConfiguration restClientConfiguration,
            IClientTokenManagerConfiguration clientTokenManagerConfiguration)
            : this(actorKey, actorManager, certificateRepository, restClientConfiguration)
        {
            Verify.IsNotNull(nameof(clientTokenManagerConfiguration), clientTokenManagerConfiguration);

            _clientTokenManagerConfiguration = clientTokenManagerConfiguration;
            _clientTokenManager = new ClientTokenManager(_certificateRepository, _clientTokenManagerConfiguration, _restClientConfiguration);
        }
示例#4
0
 public ExternalHttpErrorLogger(IOptions <LogOptions> logOptions, IClientTokenManager tokenManager)
 {
     this.logOptions   = logOptions.Value;
     this.tokenManager = tokenManager;
 }