ui/src/main/java/ucar/nc2/ui/widget/UrlAuthenticatorDialog.java
public Credentials getCredentials(AuthScope scope)
 {
    serverF.setText(scope.getHost()+":"+scope.getPort());
    String realmName = scope.getRealm();
    if (realmName == null) {
      realmName = "THREDDS Data Server";
    }
    realmF.setText(realmName);
    dialog.setVisible( true);
    if (pwa == null) throw new IllegalStateException();
    if (debug) {
      System.out.println("user= ("+pwa.getUserName()+")");
      System.out.println("password= ("+new String(pwa.getPassword())+")");
    }
    // Is this really necessary?
    UsernamePasswordCredentials upc = new UsernamePasswordCredentials(pwa.getUserName(), new String(pwa.getPassword()));
    return upc;
  }
public Credentials getCredentials(AuthScope scope)
 {
    serverF.setText(scope.getHost()+":"+scope.getPort());
    String realmName = scope.getRealm();
    if (realmName == null) {
      realmName = "THREDDS Data Server";
    }
    realmF.setText(realmName);
    dialog.setVisible( true);
    if (pwa == null) throw new IllegalStateException();
    if (debug) {
      System.out.println("user= ("+pwa.getUserName()+")");
      System.out.println("password= ("+new String(pwa.getPassword())+")");
    }
    // Is this really necessary?
    UsernamePasswordCredentials upc = new UsernamePasswordCredentials(pwa.getUserName(), new String(pwa.getPassword()));
    return upc;
  }
http client calls this: