use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.
the class AdminWhitelistRuleConfiguratorTest method checkM2SSecurityKillSwitch_enabled.
@Test
@Issue("Issue #28")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Slave2MasterSecurityKillSwitch_enabled.yml")
public void checkM2SSecurityKillSwitch_enabled() throws Exception {
final Jenkins jenkins = Jenkins.getInstance();
AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
Assert.assertTrue("MasterToSlave Security should be enabled", rule.getMasterKillSwitch());
}
use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.
the class AdminWhitelistRuleConfiguratorTest method checkA2MAccessControl_disable.
@Test
@Issue("Issue #172")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Agent2MasterSecurityKillSwitch_disabled.yml")
public void checkA2MAccessControl_disable() throws Exception {
final Jenkins jenkins = Jenkins.get();
MasterKillSwitchConfiguration config = jenkins.getDescriptorByType(MasterKillSwitchConfiguration.class);
Assert.assertFalse("Agent → Master Access Control should be disabled", config.getMasterToSlaveAccessControl());
AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
final Configurator c = context.lookupOrFail(AdminWhitelistRule.class);
final CNode node = c.describe(rule, context);
final Mapping agent = node.asMapping();
assertEquals("false", agent.get("enabled").toString());
}
use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.
the class AdminWhitelistRuleConfiguratorTest method checkA2MAccessControl_enabled.
@Test
@Issue("Issue #172")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Agent2MasterSecurityKillSwitch_enabled.yml")
public void checkA2MAccessControl_enabled() throws Exception {
final Jenkins jenkins = Jenkins.get();
MasterKillSwitchConfiguration config = jenkins.getDescriptorByType(MasterKillSwitchConfiguration.class);
Assert.assertTrue("Agent → Master Access Control should be enabled", config.getMasterToSlaveAccessControl());
AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
final Configurator c = context.lookupOrFail(AdminWhitelistRule.class);
final CNode node = c.describe(rule, context);
final Mapping agent = node.asMapping();
assertEquals("true", agent.get("enabled").toString());
}
use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.
the class AdminWhitelistRuleConfiguratorTest method checkM2ASecurityKillSwitch_disabled.
@Test
@Issue("Issue #28")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Agent2MasterSecurityKillSwitch_enabled.yml")
public void checkM2ASecurityKillSwitch_disabled() {
final Jenkins jenkins = Jenkins.get();
AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
Assert.assertFalse("MasterToAgent Security should be disabled", rule.getMasterKillSwitch());
}
use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.
the class AdminWhitelistRuleConfiguratorTest method checkM2SSecurityKillSwitch_disabled.
@Test
@Issue("Issue #28")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Slave2MasterSecurityKillSwitch_disabled.yml")
public void checkM2SSecurityKillSwitch_disabled() throws Exception {
final Jenkins jenkins = Jenkins.getInstance();
AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
Assert.assertFalse("MasterToSlave Security should be disabled", rule.getMasterKillSwitch());
}
Aggregations