use of org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method authenticationOKFromURL.
@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOKFromURL() throws IOException, InterruptedException {
// navigate to root
jenkins.open();
String rootUrl = jenkins.getCurrentUrl();
SAMLContainer samlServer = startSimpleSAML(rootUrl);
GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
sc.open();
// Authentication
SamlSecurityRealm realm = configureBasicSettings(sc);
realm.setUrl(createIdPMetadataURL(samlServer));
configureEncrytion(realm);
configureAuthorization(sc);
// SAML service login page
waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
// SAML server login
makeLoginWithUser1();
}
use of org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method configureBasicSettings.
private SamlSecurityRealm configureBasicSettings(GlobalSecurityConfig sc) {
SamlSecurityRealm realm = sc.useRealm(SamlSecurityRealm.class);
realm.setUserNameAttribute("uid");
realm.setGroupsAttribute("eduPersonAffiliation");
realm.setEmailAttribute("email");
realm.setDisplayNameAttribute("displayName");
realm.advancedConfig();
realm.setSpEntityIdAttribute(SERVICE_PROVIDER_ID);
return realm;
}
use of org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method authenticationFail.
@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationFail() throws IOException, InterruptedException {
// navigate to root
jenkins.open();
String rootUrl = jenkins.getCurrentUrl();
SAMLContainer samlServer = startSimpleSAML(rootUrl);
GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
sc.open();
// Authentication
SamlSecurityRealm realm = configureBasicSettings(sc);
String idpMetadata = readIdPMetadataFromURL(samlServer);
realm.setXml(idpMetadata);
configureEncrytion(realm);
configureAuthorization(sc);
// SAML service login page
waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
// SAML server login
find(by.id("username")).sendKeys("user1");
find(by.id("password")).sendKeys("WrOnGpAsSwOrD");
find(by.button("Login")).click();
// wait for the login to propagate
waitFor().withTimeout(5, TimeUnit.SECONDS).until(() -> hasContent("Either no user with the given username could be found, or the password you gave was wrong").matchesSafely(driver));
assertThat(jenkins.getCurrentUrl(), containsString("simplesaml/module.php/core/loginuserpass.php"));
}
use of org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method authenticationOK.
@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOK() throws IOException, InterruptedException {
// navigate to root
jenkins.open();
String rootUrl = jenkins.getCurrentUrl();
SAMLContainer samlServer = startSimpleSAML(rootUrl);
GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
sc.open();
// Authentication
SamlSecurityRealm realm = configureBasicSettings(sc);
String idpMetadata = readIdPMetadataFromURL(samlServer);
realm.setXml(idpMetadata);
realm.setBinding(SAML2_REDIRECT_BINDING_URI);
configureEncrytion(realm);
configureAuthorization(sc);
// SAML service login page
waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
makeLoginWithUser1();
}
use of org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method authenticationOKPostBinding.
@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOKPostBinding() throws IOException, InterruptedException {
// navigate to root
jenkins.open();
String rootUrl = jenkins.getCurrentUrl();
SAMLContainer samlServer = startSimpleSAML(rootUrl);
GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
sc.open();
// Authentication
SamlSecurityRealm realm = configureBasicSettings(sc);
String idpMetadata = readIdPMetadataFromURL(samlServer);
realm.setXml(idpMetadata);
realm.setBinding(SAML2_POST_BINDING_URI);
configureEncrytion(realm);
configureAuthorization(sc);
// SAML service login page
waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
// SAML server login
makeLoginWithUser1();
}
Aggregations