コード例 #1
0
  /**
   * Tests the {@code getValidatedAuthorizationDN} method for a normal user that exists in the
   * directory data and doesn't have any restrictions on its use.
   *
   * @throws Exception If an unexpected problem occurs.
   */
  @Test()
  public void testGetValidatedAuthorizationExistingNormalUser() throws Exception {
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.addEntry(
        "dn: uid=test,o=test",
        "objectClass: top",
        "objectClass: person",
        "objectClass: organizationalPerson",
        "objectClass: inetOrgPerson",
        "uid: test",
        "givenName: Test",
        "sn: User",
        "cn: Test User");

    ProxiedAuthV1Control proxyControl = new ProxiedAuthV1Control(DN.decode("uid=test,o=test"));

    assertEquals(proxyControl.getAuthorizationEntry().getDN(), DN.decode("uid=test,o=test"));
  }
コード例 #2
0
  /**
   * Tests the {@code getValidatedAuthorizationDN} method for a disabled user.
   *
   * @throws Exception If an unexpected problem occurs.
   */
  @Test(expectedExceptions = {DirectoryException.class})
  public void testGetValidatedAuthorizationDisabledUser() throws Exception {
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.addEntry(
        "dn: uid=test,o=test",
        "objectClass: top",
        "objectClass: person",
        "objectClass: organizationalPerson",
        "objectClass: inetOrgPerson",
        "uid: test",
        "givenName: Test",
        "sn: User",
        "cn: Test User",
        "ds-pwp-account-disabled: true");

    ProxiedAuthV1Control proxyControl = new ProxiedAuthV1Control(DN.decode("uid=test,o=test"));

    proxyControl.getAuthorizationEntry();
  }