How can I configure a DB user before connecting to the DB?

I’m updating the company’s code base to use Orient 3.0.23 instead of Orient 2.2.x. I’d like to make the smallest amount of changes as possible so the APIs I provide to my customers have the least amount of change (if any at all). I can’t connect to Orient DB since I can’t create an admin user with the password I choose. If I use default admin, my software is out of FIPS compliance and throws a FIPS related exception.

Here’s a code snippet

AccessController.doPrivileged((PrivilegedExceptionAction<Void>)() -> {
      System.setProperty("ORIENTDB_HOME", getServerPath());
      System.setProperty("orientdb.installCustomFormatter", "false");
      server = OServerMain.create();

      // Retrieve and sanitize the config file
      OServerConfigurationManager configManager = new OServerConfigurationManager(orientServerConfigFile.getInputStream());
      processConfiguration(configManager);

      // The following line prevents Orient from creating the default "admin", "reader", and
      // "writer" users on any database created in the server since we don't need them all and
      // the default creation of them uses non-FIPS compliant passwords.  We'll recreate the
      // "admin" database user later with a FIPS compliant password - see configureOrientDbUsers().
      OGlobalConfiguration.CREATE_DEFAULT_USERS.setValue(Boolean.FALSE);

      server.startup(configManager.getConfiguration());
      // Override default root with better password
      server.addUser("root", ByteArrayUtil.toHexString(getPasswordFromKeyRing(KEY_RING_ROOT_ALIAS)), "*");

      // Temporarily add the guest user with a FIPS compliant password (since the activate()
      // call that follows will re-create a "guest" user with a default, non-FIPS compliant
      // password if we don't do this.
      server.addUser("guest", ByteArrayUtil.toHexString(getPasswordFromKeyRing(KEY_RING_ROOT_ALIAS)), " ");

      // Start the server
      server.activate();

      // Now we can go ahead and drop the "guest" user since we don't actually want it, we are
      // just forced to deal with it due to Orient's stubborn nature :).
      server.dropUser("guest");

      return null;
    });

    OrientDB db = server.getContext();
    db.createIfNotExists(DB_NAME, ODatabaseType.PLOCAL, config);

    // Create the GraphFactory
    graphFactory = (OrientDBEmbedded) db.open(DB_NAME, "admin", "fipsCompliantPassword here");

I’m unable to open the DB since I’m unable to configure the admin password with the code I have. What change do I need to make so I may change the admin password before connecting to the DB?

Hi @ErikShiken

you should be able to connect with root credentials and then just do an UPDATE on OUser class to update the passwords (they are automatically encrypted by a hook)

Thanks

Luigi