Search in sources :

Example 6 with AdminWhitelistRule

use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.

the class AdminWhitelistRuleConfigurator method configure.

@Override
public AdminWhitelistRule configure(Object config) throws Exception {
    Injector injector = Jenkins.getInstance().getInjector();
    AdminWhitelistRule instance = injector.getInstance(AdminWhitelistRule.class);
    configure((Map) config, instance);
    return instance;
}
Also used : AdminWhitelistRule(jenkins.security.s2m.AdminWhitelistRule) Injector(com.google.inject.Injector)

Example 7 with AdminWhitelistRule

use of jenkins.security.s2m.AdminWhitelistRule in project configuration-as-code-plugin by jenkinsci.

the class AdminWhitelistRuleConfiguratorTest method checkM2ASecurityKillSwitch_enabled.

@Test
@Issue("Issue #28")
@ConfiguredWithCode("AdminWhitelistRuleConfigurator/Agent2MasterSecurityKillSwitch_disabled.yml")
public void checkM2ASecurityKillSwitch_enabled() {
    final Jenkins jenkins = Jenkins.get();
    AdminWhitelistRule rule = jenkins.getInjector().getInstance(AdminWhitelistRule.class);
    Assert.assertTrue("MasterToAgent Security should be enabled", rule.getMasterKillSwitch());
}
Also used : Jenkins(jenkins.model.Jenkins) AdminWhitelistRule(jenkins.security.s2m.AdminWhitelistRule) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) ConfiguredWithCode(io.jenkins.plugins.casc.misc.ConfiguredWithCode)

Aggregations

AdminWhitelistRule (jenkins.security.s2m.AdminWhitelistRule)7 Jenkins (jenkins.model.Jenkins)6 Test (org.junit.Test)6 Issue (org.jvnet.hudson.test.Issue)6 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)4 ConfigurationContext (io.jenkins.plugins.casc.ConfigurationContext)2 Configurator (io.jenkins.plugins.casc.Configurator)2 ConfiguratorRegistry (io.jenkins.plugins.casc.ConfiguratorRegistry)2 CNode (io.jenkins.plugins.casc.model.CNode)2 Mapping (io.jenkins.plugins.casc.model.Mapping)2 MasterKillSwitchConfiguration (jenkins.security.s2m.MasterKillSwitchConfiguration)2 ConfiguredWithCode (org.jenkinsci.plugins.casc.misc.ConfiguredWithCode)2 Injector (com.google.inject.Injector)1