Skip to content
Permalink
Browse files

[JENKINS-45431] Updated after review

  • Loading branch information...
fcojfernandez committed Aug 30, 2017
1 parent b32622d commit 558839079c074e9e39268d6b8bffbd2932244053
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/test/java/hudson/security/LDAPEmbeddedTest.java
@@ -489,4 +489,34 @@ public void validate() throws Exception {
assertThat("Always report outer kind as OK", validation.kind, is(FormValidation.Kind.OK));
}

@Test
@LDAPSchema(ldif = "planetexpress", id = "planetexpress", dn = "dc=planetexpress,dc=com")
public void usingEnvironmentProperties() throws Exception {
LDAPConfiguration c = new LDAPConfiguration(ads.getUrl(), "", false, "uid=admin,ou=system", Secret.fromString("pass"));

LDAPSecurityRealm.EnvironmentProperty[] environmentProperties = {new LDAPSecurityRealm.EnvironmentProperty("java.naming.ldap.typesOnly", "true")};
c.setEnvironmentProperties(environmentProperties);

List<LDAPConfiguration> configurations = new ArrayList<LDAPConfiguration>();
configurations.add(c);
LDAPSecurityRealm realm = new LDAPSecurityRealm(
configurations,
false,
new LDAPSecurityRealm.CacheConfiguration(100, 1000),
IdStrategy.CASE_INSENSITIVE,
IdStrategy.CASE_INSENSITIVE
);

r.jenkins.setSecurityRealm(realm);
r.submit(r.createWebClient().goTo("configureSecurity").getFormByName("config"));

try {
r.createWebClient().login("fry", "fry");
fail("Should not be able to login");
} catch (FailingHttpStatusCodeException e) {
System.out.println("Got a bad login==good");
}
}


}

0 comments on commit 5588390

Please sign in to comment.
You can’t perform that action at this time.