Search in sources :

Example 16 with GlobalSecurityConfig

use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.

the class AuthorizeProjectTest method setup.

@Before
public void setup() {
    final GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
    security.open();
    this.setupUsers(security, USER1, USER2);
    security.save();
}
Also used : GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig) Before(org.junit.Before)

Example 17 with GlobalSecurityConfig

use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.

the class CredentialsTest method createUserAndLogin.

private void createUserAndLogin() {
    final GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
    security.open();
    MockSecurityRealm realm = security.useRealm(MockSecurityRealm.class);
    realm.configure(JENKINS_USER);
    security.save();
    jenkins.login().doLogin(JENKINS_USER);
}
Also used : MockSecurityRealm(org.jenkinsci.test.acceptance.plugins.mock_security_realm.MockSecurityRealm) GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)

Example 18 with GlobalSecurityConfig

use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.

the class TriggerRemoteBuildsTest method triggerBuildRemotely.

@Test
@Category(SmokeTest.class)
public void triggerBuildRemotely() {
    GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
    sc.open();
    sc.useRealm(ServletSecurityRealm.class);
    sc.save();
    FreeStyleJob subject = jenkins.jobs.create();
    subject.configure();
    subject.addParameter(StringParameter.class).setName("ID");
    // Trigger builds remotely (e.g., from scripts)")
    // TODO move to page area
    jenkins.control("/pseudoRemoteTrigger").resolve().findElement(by.xpath("../label")).click();
    jenkins.control("/pseudoRemoteTrigger/authToken").fillIn("authToken", "TOKEN");
    subject.addShellStep("test 'id_to_pass' = $ID");
    subject.save();
    FreeStyleJob trigger = jenkins.jobs.create();
    trigger.addShellStep("curl " + subject.url.toString() + "buildWithParameters?token=TOKEN\\&ID=id_to_pass");
    trigger.save();
    trigger.startBuild().shouldSucceed();
    subject.getLastBuild().shouldSucceed();
}
Also used : StringParameter(org.jenkinsci.test.acceptance.po.StringParameter) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig) Category(org.junit.experimental.categories.Category) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) SmokeTest(org.jenkinsci.test.acceptance.junit.SmokeTest) Test(org.junit.Test)

Example 19 with GlobalSecurityConfig

use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.

the class ActiveDirectoryTest method wannabe_cannot_login_to_Jenkins_after_AD_security_configured.

@Test
public void wannabe_cannot_login_to_Jenkins_after_AD_security_configured() {
    userCanLoginToJenkinsAsAdmin(ENV.getUser());
    String userWannabe = ENV.getUser() + "-wannabe";
    GlobalSecurityConfig security = saveSecurityConfig(userWannabe);
    jenkins.logout();
    jenkins.login().doLogin(userWannabe, ENV.getPassword());
    security.configure();
    assertThat(getElement(by.name("_.domain")), is(nullValue()));
    jenkins.login().doLogin(ENV.getUser(), ENV.getPassword());
}
Also used : GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 20 with GlobalSecurityConfig

use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.

the class ActiveDirectoryTest method saveSecurityConfig.

private GlobalSecurityConfig saveSecurityConfig(String userOrGroupToAddAsAdmin) {
    GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
    security.configure();
    security = ProjectBasedMatrixAuthorizationStrategy.authorizeUserAsAdmin(userOrGroupToAddAsAdmin, security);
    security = configSecurityRealm(security);
    security.save();
    return security;
}
Also used : GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)

Aggregations

GlobalSecurityConfig (org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)29 Test (org.junit.Test)17 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)15 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)9 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)9 MockSecurityRealm (org.jenkinsci.test.acceptance.plugins.mock_security_realm.MockSecurityRealm)7 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)5 Build (org.jenkinsci.test.acceptance.po.Build)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 SAMLContainer (org.jenkinsci.test.acceptance.docker.fixtures.SAMLContainer)4 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)4 MatrixAuthorizationStrategy (org.jenkinsci.test.acceptance.plugins.matrix_auth.MatrixAuthorizationStrategy)4 SamlSecurityRealm (org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm)4 Before (org.junit.Before)4 MatrixRow (org.jenkinsci.test.acceptance.plugins.matrix_auth.MatrixRow)3 LdapSecurityRealm (org.jenkinsci.test.acceptance.po.LdapSecurityRealm)3 LdapDetails (org.jenkinsci.test.acceptance.plugins.ldap.LdapDetails)2 ProjectBasedMatrixAuthorizationStrategy (org.jenkinsci.test.acceptance.plugins.matrix_auth.ProjectBasedMatrixAuthorizationStrategy)2 JenkinsDatabaseSecurityRealm (org.jenkinsci.test.acceptance.po.JenkinsDatabaseSecurityRealm)2 Login (org.jenkinsci.test.acceptance.po.Login)2