code: @Nullable
    private static Identifiers handleIdentifiers(String domainIdOrName, String projectIdOrName,
        String endpoint, String userId, String password) {
  
      //we try all four cases and return the one that works
      Set<Identifiers> possibleIdentifiers = new HashSet<Identifiers>() {{
        add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byName(projectIdOrName)));
        add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byId(projectIdOrName)));
        add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byName(projectIdOrName)));
        add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byId(projectIdOrName)));
      }};
  
      for (Identifiers candidate : possibleIdentifiers) {
        try {
          authenticate(endpoint, userId, password, candidate.getDomain(), candidate.getProject());
        } catch (AuthenticationException | ClientResponseException e) {
          continue;
        }
        return candidate;
      }
      return null;
    }
docs: This method tries to determine if the authentication should happen by using the user provided
  information as domain ID or domain name resp. project ID or project name.
  
  It does so by brute forcing the four different possible combinations.
  
  Returns early on success.
  
  @param domainIdOrName the domain id or name
  @param projectIdOrName the project id or name
  @param endpoint the endpoint
  @param userId the user
  @param password the password of the user
  @return The valid identifiers if a valid combination exists or null if all combinations failed.