コード例 #1
0
        private OdsApiCredential CreateNewApiClient(CloudOdsEnvironment environment, Application newApplication)
        {
            var apiWithCredentials =
                new ApiClientFactory(_securePackedHashProvider, _hashConfigurationProvider)
                .GetApiClientAndCredentials(environment, CloudsOdsAcademicBenchmarksConnectApp.ApplicationName);

            newApplication.ApiClients.Add(apiWithCredentials.ApiClient);

            return(apiWithCredentials.ApiCredentials);
        }
コード例 #2
0
        public ApiWithCredentials GetApiClientAndCredentials(CloudOdsEnvironment environment, 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
            });
        }
コード例 #3
0
 public static bool IsInEnvironment(this CloudOdsWebsite site, CloudOdsEnvironment environment)
 {
     return(site.Environment == environment);
 }