public Capability1CallbackController(IConfiguration configuration, ITestLogic testLogic) : base(configuration, testLogic)
        {
            var nexusSettings    = configuration.GetSection("Nexus").Get <NexusSettings>();
            var platformSettings = configuration.GetSection("Platform").Get <PlatformSettings>();
            // Note! Assumes same /Tokens endpoint in the Business API as in Nexus Fundamentals
            var authManager    = new NexusAuthenticationManager(nexusSettings.Tenant, platformSettings.IntegrationApiUrl);
            var tokenRefresher = authManager.CreateTokenRefresher(new AuthenticationCredentials {
                ClientId = platformSettings.ClientId, ClientSecret = platformSettings.ClientSecret
            });

            // Note! Assumes same /TestBench endpoint in the Business API as in Nexus Business Events
            _businessEventsClient = new BusinessEvents(platformSettings.IntegrationApiUrl, nexusSettings.Tenant, tokenRefresher.GetServiceClient());
        }
        public IntegrationApiMockController(IConfiguration configuration)
        {
            var tenant = new Tenant(configuration["Nexus:Organization"], configuration["Nexus:Environment"]);

            _authManager = new AuthenticationManager(tenant, configuration["Nexus:FundamentalsUrl"]);

            var credentials = new AuthenticationCredentials {
                ClientId = configuration["Nexus:ClientId"], ClientSecret = configuration["Nexus:ClientSecret"]
            };
            var nexusAuthManager = new NexusAuthenticationManager(tenant, configuration["Nexus:FundamentalsUrl"]);

            _businessEventsClient = new BusinessEvents(configuration["Nexus:BusinessEventsUrl"], tenant, nexusAuthManager.CreateTokenRefresher(credentials).GetServiceClient());
        }
コード例 #3
0
        private void ConfigureNexus(IServiceCollection services)
        {
            var tenant      = new Tenant(Configuration["Nexus:Organization"], Configuration["Nexus:Environment"]);
            var credentials = new AuthenticationCredentials {
                ClientId = Configuration["Nexus:ClientId"], ClientSecret = Configuration["Nexus:ClientSecret"]
            };
            var nexusAuthManager    = new NexusAuthenticationManager(tenant, Configuration["Nexus:FundamentalsUrl"]);
            var nexusTokenRefresher = nexusAuthManager.CreateTokenRefresher(credentials);

            var translatorService = CreateTranslatorService(tenant, nexusTokenRefresher);

            ValueTranslatorHttpSender.TranslatorService = translatorService;
            services.AddSingleton(provider => translatorService);

            services.AddValueTranslatorFilter();
            services.AddScoped(provider => new Capability1RestClient(new ValueTranslatorHttpSender(new HttpSender(Configuration["Capability1:BaseUrl"]), "capability1-mock")));
        }