Exemple #1
0
        public static void LoadConfig(TestContext testContext)
        {
            var reader = new StreamReader(Environment.GetEnvironmentVariable("RC_GRIP_CONFIG"));
            var configObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(reader.ReadToEnd());

            config = new PublishControl.Configuration(configObj["gripProxiesString"].ToString());
            config.Entries.Add(new Configuration.Entry() { ControlIss = "test-iss", Key = Encoding.UTF8.GetBytes("test-key") });

            config2 = new PublishControl.Configuration(configObj["gripProxiesString2"].ToString());
        }
        public void ApplyConfiguration(Configuration config)
        {
            foreach (var entry in config.Entries)
            {
                if (entry.ControlUri == null)
                    continue;

                var publishControl = new PublishControl(entry.ControlUri);
                if (entry.ControlIss != null)
                {
                    var claim = new Dictionary<string, object>();
                    claim["iss"] = entry.ControlIss;
                    publishControl.SetAuthJwt(claim, entry.Key);
                }

                publishControls.Add(publishControl);
            }
        }