public EvrikaPrinterClient(IEvrikaPrinterClientSettings settings, IMasterPortalSettings masterPortalSettings, IPortalSettings portalSettings) { var provider = new ApiKeyAuthenticationProvider(portalSettings.ApiKey); var authClient = new AuthClient(new ClientSettings(provider, new FakeLog(), TimeSpan.FromSeconds(15), false), new TopologyProvider(settings.TestAuthUrls.Length > 0 ? settings.TestAuthUrls : portalSettings.AuthUrls)); var result = authClient.AuthByPassAsync2(new AuthByPassRequest(masterPortalSettings.MasterLogin, masterPortalSettings.MasterPassword)).Result; result.EnsureSuccess(); var authSid = result.Response.Sid; Console.WriteLine($"AuthSid: {authSid}"); clusterClient = new ClusterClient(null, config => { var repeatReplicasCount = settings.RepeatReplicasCount; config.ClusterProvider = new FixedClusterProvider(settings.Host); config.SetupKonturHttpTransport(); config.RepeatReplicas(repeatReplicasCount); config.ReplicaOrdering = new AsIsReplicaOrdering(); config.DefaultRequestStrategy = new ForkingRequestStrategy(new EqualDelaysProvider(repeatReplicasCount), repeatReplicasCount); config.AddRequestTransform(new DefaultHeadersTransform(new[] { new Header("Authorization", $"auth.sid {authSid}"), new Header("X-Kontur-Apikey", $"{settings.PortalApiKey}"), new Header(HeaderNames.Accept, "application/json"), })); config.DefaultTimeout = settings.Timeout; }); }