Ejemplo n.º 1
0
 public void testGetAccountBySid() {
   String accountName = Advapi32Util.getUserName();
   Account currentUser = Advapi32Util.getAccountByName(accountName);
   Account account = Advapi32Util.getAccountBySid(new PSID(currentUser.sid));
   assertEquals(SID_NAME_USE.SidTypeUser, account.accountType);
   assertEquals(currentUser.fqn.toLowerCase(), account.fqn.toLowerCase());
   assertEquals(currentUser.name.toLowerCase(), account.name.toLowerCase());
   assertEquals(currentUser.domain.toLowerCase(), account.domain.toLowerCase());
   assertEquals(currentUser.sidString, account.sidString);
 }
Ejemplo n.º 2
0
  public static void main(String[] args) {
    junit.textui.TestRunner.run(Advapi32UtilTest.class);
    String currentUserName = Advapi32Util.getUserName();
    System.out.println("GetUserName: "******" " + group.fqn + " [" + group.sidString + "]");
    }

    Account accountByName = Advapi32Util.getAccountByName(currentUserName);
    System.out.println("AccountByName: " + currentUserName);
    System.out.println(" Fqn: " + accountByName.fqn);
    System.out.println(" Domain: " + accountByName.domain);
    System.out.println(" Sid: " + accountByName.sidString);

    Account accountBySid = Advapi32Util.getAccountBySid(new PSID(accountByName.sid));
    System.out.println("AccountBySid: " + accountByName.sidString);
    System.out.println(" Fqn: " + accountBySid.fqn);
    System.out.println(" Name: " + accountBySid.name);
    System.out.println(" Domain: " + accountBySid.domain);
  }
Ejemplo n.º 3
0
 public void testGetAccountNameFromSid() {
   assertEquals("Everyone", Advapi32Util.getAccountBySid("S-1-1-0").name);
 }