code: @Nonnull
      public static IdStrategy idStrategy() {
          Jenkins j = Jenkins.get();
          SecurityRealm realm = j.getSecurityRealm();
          if (realm == null) {
              return IdStrategy.CASE_INSENSITIVE;
          }
          return realm.getUserIdStrategy();
      }
docs: Returns the {@link jenkins.model.IdStrategy} for use with {@link User} instances. See
  {@link hudson.security.SecurityRealm#getUserIdStrategy()}
  
  @return the {@link jenkins.model.IdStrategy} for use with {@link User} instances.
  @since 1.566