@Test public void realm() { Settings settings = new Settings() .setProperty("ldap.realm", "example.org") .setProperty("ldap.userObjectClass", "user") .setProperty("ldap.loginAttribute", "sAMAccountName"); LdapUserMapping userMapping = new LdapUserMapping(settings); assertThat(userMapping.getBaseDn(), equalTo("dc=example,dc=org")); }
@Test public void defaults() { LdapUserMapping userMapping = new LdapUserMapping(new Settings()); assertThat(userMapping.getBaseDn(), equalTo(null)); assertThat(userMapping.getObjectClass(), equalTo("inetOrgPerson")); assertThat(userMapping.getLoginAttribute(), equalTo("uid")); assertThat(userMapping.getRealNameAttribute(), equalTo("cn")); assertThat(userMapping.getEmailAttribute(), equalTo("mail")); assertThat( userMapping.toString(), equalTo( "LdapUserMapping{" + "baseDn=null," + " objectClass=inetOrgPerson," + " loginAttribute=uid," + " realNameAttribute=cn," + " emailAttribute=mail}")); }