Beispiel #1
0
        private async Task StoreApiCredentials(OdsApiCredential apiCreds)
        {
            var odsSecretConfiguration = await _odsSecretConfigurationProvider.GetSecretConfiguration(_instanceContext.Id);

            odsSecretConfiguration.ProductionAcademicBenchmarkApiClientKeyAndSecret =
                new ABProxyApiCredential
            {
                ApiKey    = apiCreds.Key,
                ApiSecret = apiCreds.Secret
            };

            await _odsSecretConfigurationProvider.SetSecretConfiguration(odsSecretConfiguration, _instanceContext.Id);
        }
Beispiel #2
0
        public ApiWithCredentials GetApiClientAndCredentials(string applicationName)
        {
            var apiClient = CreateProductionApiClient(applicationName);

            // Due to a bug with using GetHashCode() to verify the client secret hashes between apps,
            // we can't use secure secrets until the hashing code is fixed. The workaround for this
            // problem is to store secrets in plain text until the ODS hashing takes over when a secret
            // is used; Follow ODS-2679 for a complete resolution.
            //
            // var apiCredentials = new OdsApiCredential(apiClient.Key,
            //    apiClient.GenerateSecureClientSecret(_securePackedHashProvider, _hashConfigurationProvider));

            var apiCredentials = new OdsApiCredential(apiClient.Key, apiClient.Secret);

            return(new ApiWithCredentials
            {
                ApiClient = apiClient,
                ApiCredentials = apiCredentials
            });
        }