예제 #1
0
        private AcrClient(HttpClient httpClient, string acrName, string tenant, string aadAccessToken, ILoggerService loggerService)
        {
            _httpClient     = httpClient;
            _acrName        = acrName;
            _tenant         = tenant;
            _aadAccessToken = aadAccessToken;
            _baseUrl        = $"https://{acrName}";
            _acrV1BaseUrl   = $"{_baseUrl}/acr/v1";
            _acrV2BaseUrl   = $"{_baseUrl}/v2";

            _acrRefreshToken = new AsyncLockedValue <string>(semaphore: _sharedSemaphore);
            _acrAccessToken  = new AsyncLockedValue <string>(semaphore: _sharedSemaphore);

            _httpPolicy = HttpPolicyBuilder.Create()
                          .WithMeteredRetryPolicy(loggerService)
                          .WithRefreshAccessTokenPolicy(GetAcrRefreshTokenAsync, loggerService)
                          .Build();
        }