+ // ProxyAuthorization ///////////////////////////////////////////////////////////////////////////////////
+
+ public static class ProxyAuthorization {
+
+ static public String authorization = null;
+ static public Semaphore waitingForUser = new Semaphore();
+
+ // FIXME: Digest and NTLM
+ public static synchronized void getPassword(final String realm, final String style, final String proxyIP, String oldAuth) {
+
+ // this handles cases where multiple threads hit the proxy auth at the same time -- all but one will block on the
+ // synchronized keyword. If 'authorization' changed while the thread was blocked, it means that the user entered
+ // a password, so we should reattempt authorization.
+
+ if (authorization != oldAuth) return;
+ if (Log.on) Log.log(ProxyAuthorization.class, "displaying proxy authorization dialog");
+ MessageQueue.add(new Message() {
+ public void perform() {
+ Box b = new Box("org.xwt.builtin.proxy_authorization", null);
+ b.put("realm", realm);
+ b.put("proxyIP", proxyIP);
+ }
+ });
+
+ waitingForUser.block();
+ if (Log.on) Log.log(ProxyAuthorization.class, "got proxy authorization info; re-attempting connection");
+
+ }
+ }
+