use of jenkins.security.plugins.ldap.LDAPConfiguration in project configuration-as-code-plugin by jenkinsci.
the class LDAPTest method configure_ldap.
@Test
@ConfiguredWithReadme("ldap/README.md")
public void configure_ldap() {
final Jenkins jenkins = Jenkins.get();
final LDAPSecurityRealm securityRealm = (LDAPSecurityRealm) jenkins.getSecurityRealm();
assertEquals(1, securityRealm.getConfigurations().size());
assertTrue(securityRealm.getUserIdStrategy() instanceof IdStrategy.CaseInsensitive);
assertTrue(securityRealm.getGroupIdStrategy() instanceof IdStrategy.CaseSensitive);
final LDAPConfiguration configuration = securityRealm.getConfigurations().get(0);
assertEquals("ldap.acme.com", configuration.getServer());
assertEquals("SECRET", configuration.getManagerPassword());
assertEquals("manager", configuration.getManagerDN());
assertEquals("(&(objectCategory=User)(sAMAccountName={0}))", configuration.getUserSearch());
assertEquals("(&(cn={0})(objectclass=group))", configuration.getGroupSearchFilter());
final FromGroupSearchLDAPGroupMembershipStrategy strategy = ((FromGroupSearchLDAPGroupMembershipStrategy) configuration.getGroupMembershipStrategy());
assertEquals("(&(objectClass=group)(|(cn=GROUP_1)(cn=GROUP_2)))", strategy.getFilter());
}
use of jenkins.security.plugins.ldap.LDAPConfiguration in project configuration-as-code-plugin by jenkinsci.
the class LDAPSecurityRealmTest method configure_securityRealm.
@Test
@ConfiguredWithCode("LDAPSecurityRealmTest.yml")
public void configure_securityRealm() {
final Jenkins jenkins = Jenkins.getInstance();
final LDAPSecurityRealm securityRealm = (LDAPSecurityRealm) jenkins.getSecurityRealm();
assertEquals(1, securityRealm.getConfigurations().size());
assertTrue(securityRealm.getUserIdStrategy() instanceof IdStrategy.CaseInsensitive);
assertTrue(securityRealm.getGroupIdStrategy() instanceof IdStrategy.CaseSensitive);
final LDAPConfiguration configuration = securityRealm.getConfigurations().get(0);
assertEquals("ldap.acme.com", configuration.getServer());
assertEquals("SECRET", configuration.getManagerPassword());
}
Aggregations