docs: public static Duet getId(DbConn cnx)
      {
          Duet currentLoginData = logindata; // Pointer copy to avoid having it reset under us during this method run.
          RUser currentUser = user;
  
          if (useAuth == null)
          {
              useAuth = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "enableWsApiAuth", "true"));
          }
  
          if (currentLoginData == null)
          {
              currentLoginData = new Duet();
              currentLoginData.pass = null;
              currentLoginData.usr = null;
              logindata = currentLoginData;
          }
  
          if (!useAuth)
          {
              jqmlogger.debug("The client web API calls will not use any authentication");
              return currentLoginData;
          }
  
          // Renew one day before limit, to ensure account is valid for a day.
          Calendar renewalLimit = null;
          if (currentUser != null)
          {
              renewalLimit = (Calendar) currentUser.getExpirationDate().clone(); // clone. otherwise we modify the user object next line!
              renewalLimit.add(Calendar.DAY_OF_YEAR, -1);
          }
  
          if (currentUser == null || renewalLimit == null || renewalLimit.before(Calendar.getInstance()))
          {
              synchronized (lock)
              {
                  if (currentUser == null || currentUser.getExpirationDate().before(Calendar.getInstance()))
                  {
                      jqmlogger.debug("The client API will create an internal secret to access the simple API");
  
                      // Create new
                      String login = UUID.randomUUID().toString();
  
                      secret = UUID.randomUUID().toString();
                      ByteSource salt = new SecureRandomNumberGenerator().nextBytes();
                      String hash = new Sha512Hash(secret, salt, 100000).toHex();
                      String saltS = salt.toHex();
  
                      Calendar expiration = Calendar.getInstance();
                      expiration.add(Calendar.DAY_OF_YEAR, 2);
  
                      int id = RUser.create(cnx, login, hash, saltS, expiration, true, "administrator");
                      currentUser = RUser.select_id(cnx, id);
                      user = currentUser;
  
                      currentLoginData = new Duet();
                      currentLoginData.pass = secret;
                      currentLoginData.usr = login;
                      logindata = currentLoginData;
  
                      // Purge all old internal accounts
                      cnx.runUpdate("user_delete_expired_internal");
  
                      cnx.commit();
                  }
              }
          }
  
          return currentLoginData;
      }