コード例 #1
0
  @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"));
  }
コード例 #2
0
  @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}"));
  }