コード例 #1
1
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
  protected void assertCreateUserFromLdap(Fixture fixture, Map<String, List<String>> users) {
    LdapImpl ldap = fixture.ldap;
    for (String user : users.keySet()) {
      String dn = null;
      try {
        dn = ldap.findDN(user);
      } catch (ApiUsageException aue) {
        throw aue;
      }

      assertNotNull(dn);
      assertEquals(
          fixture.ignoreCaseLookup ? user.toLowerCase() : user,
          ldap.findExperimenter(user).getOmeName());
      fixture.createUserWithGroup(this, dn, users.get(user).get(0));
      assertNotNull(fixture.createUser(user));
      try {
        fixture.createUser("nonExistingUserShouldNotBeCreated");
      } catch (ApiUsageException aue) {
        // Expected
        continue;
      }
      fail("This user shouldn't have been created!");
    }
  }
コード例 #2
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 protected void assertFails(Fixture fixture, Map<String, List<String>> users) {
   LdapImpl ldap = fixture.ldap;
   for (String user : users.keySet()) {
     assertEquals(1, users.get(user).size());
     try {
       String dn = ldap.findDN(user);
       assertNotNull(dn);
       fixture.createUserWithGroup(this, dn, users.get(user).get(0));
       assertNotNull(fixture.createUser(user, "password", true));
       fixture.login(user, users.get(user).get(0), "password");
       // Parsing afterwards to force an explosion to reproduce #2557
       assertEquals(user, ldap.findExperimenter(user).getOmeName());
       fail("user didn't fail");
     } catch (ValidationException e) {
       if (e.getMessage().equals("No group found for: cn=user,ou=attributeFilter")) {
         // Good. This is the expected result for #8357
       } else {
         throw e;
         // This means that we couldn't insert.
         // See the thread on case-sensitivity in #2557
       }
     } catch (ApiUsageException e) {
       // If not a ValidationException, but otherwise an
       // ApiUsageException, then this will be the
       // "Cannot find unique DN" which we are looking for.
     } catch (SecurityViolation sv) {
       // e.g. User 466 is not a member of group 54 and cannot login
       // Also good.
     }
   }
 }
コード例 #3
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
  protected void assertPasses(Fixture fixture, Map<String, List<String>> users) throws Exception {
    LdapImpl ldap = fixture.ldap;

    for (String user : users.keySet()) {
      String dn = null;
      assertTrue(1 <= users.get(user).size());
      try {
        dn = ldap.findDN(user);
      } catch (ApiUsageException aue) {
        // This will be one of the major errors: when we can't find a
        // user that we expect to find. Adding a try/catch block for
        // debugging purposes.
        throw aue;
      }

      assertNotNull(dn);
      assertEquals(
          fixture.ignoreCaseLookup ? user.toLowerCase() : user,
          ldap.findExperimenter(user).getOmeName());
      fixture.createUserWithGroup(this, dn, users.get(user).get(0));
      assertNotNull(fixture.createUser(user, "password", true));
      fixture.login(
          fixture.ignoreCaseLookup ? user.toLowerCase() : user, users.get(user).get(0), "password");
    }
  }
コード例 #4
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 public List<Experimenter> discover() {
   return ldap.discover();
 }
コード例 #5
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 public void setDN(Long experimenterID, String dn) {
   ldap.setDN(experimenterID, dn);
 }
コード例 #6
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 public Experimenter findExperimenter(String username) {
   return ldap.findExperimenter(username);
 }
コード例 #7
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 public Experimenter createUser(String user, String string, boolean checkPassword) {
   return ldap.createUser(user, "password", checkPassword);
 }
コード例 #8
0
ファイル: LdapTest.java プロジェクト: kok26th/openmicroscopy
 public Experimenter createUser(String user) {
   return ldap.createUser(user);
 }