public synchronized Authorization reauthorize(URI uri, Authorization authorization) {
      // Double check that another thread hasn't already prompted and updated the secure store or
      // has not already permanently failed to authorize.
      Authorization currentAuthorization = authorize(uri);
      if (!currentAuthorization.equals(authorization)
          || currentAuthorization == Authorization.UNAUTHORIZEABLE) {
        return currentAuthorization;
      }

      if (uiServices != null) {
        String host = getHost(uri);
        if (host != null) {
          AuthenticationInfo authenticationInfo = uiServices.getUsernamePassword(uri.toString());
          String user = authenticationInfo.getUserName();
          String password = authenticationInfo.getPassword();
          Authorization reauthorization = new Authorization(user, password);
          if (reauthorization.isAuthorized()) {
            if (authenticationInfo.saveResult() && securePreferences != null) {
              try {
                ISecurePreferences node = securePreferences.node(host);
                node.put("user", user, false);
                node.put("password", password, true);
                node.flush();
              } catch (IOException ex) {
                SetupCorePlugin.INSTANCE.log(ex);
              } catch (StorageException ex) {
                SetupCorePlugin.INSTANCE.log(ex);
              }
            }

            authorizations.put(host, reauthorization);
            return reauthorization;
          } else {
            authorizations.put(host, Authorization.UNAUTHORIZEABLE);
            return Authorization.UNAUTHORIZEABLE;
          }
        }
      }

      return currentAuthorization;
    }
 public AuthenticationInfo getUsernamePassword(
     String location, AuthenticationInfo previousInfo) {
   if (hookedAuthDialog != null)
     return hookedAuthDialog.getUsernamePassword(location, previousInfo);
   return null;
 }