⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 authenticatorwindow.java

📁 java 文件下载器。可自定义
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				final AuthenticatorWindow val$this$0;
				final authDialog this$1;

				public void handleEvent(Event e)
				{
					close(true);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			Button bCancel = new Button(shell, 8);
			Messages.setLanguageText(bCancel, "Button.cancel");
			gridData = new GridData(128);
			gridData.grabExcessHorizontalSpace = false;
			gridData.widthHint = 70;
			bCancel.setLayoutData(gridData);
			bCancel.addListener(13, new Listener() {

				final AuthenticatorWindow val$this$0;
				final authDialog this$1;

				public void handleEvent(Event e)
				{
					close(false);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			shell.setDefaultButton(bOk);
			shell.addListener(31, new Listener() {

				final AuthenticatorWindow val$this$0;
				final authDialog this$1;

				public void handleEvent(Event e)
				{
					if (e.character == '\033')
						close(false);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			shell.pack();
			Utils.centreWindow(shell);
			shell.open();
		}
	}


	private static final String CONFIG_PARAM = "swt.auth.persistent.cache";
	protected Map auth_cache;
	protected AEMonitor this_mon;

	public AuthenticatorWindow()
	{
		auth_cache = new HashMap();
		this_mon = new AEMonitor("AuthWind");
		SESecurityManager.addPasswordListener(this);
		Map cache = COConfigurationManager.getMapParameter("swt.auth.persistent.cache", new HashMap());
		try
		{
			String key;
			String user;
			char pw[];
			for (Iterator it = cache.entrySet().iterator(); it.hasNext(); auth_cache.put(key, new authCache(key, new PasswordAuthentication(user, pw), true)))
			{
				java.util.Map.Entry entry = (java.util.Map.Entry)it.next();
				key = (String)entry.getKey();
				Map value = (Map)entry.getValue();
				user = new String((byte[])(byte[])value.get("user"), "UTF-8");
				pw = (new String((byte[])(byte[])value.get("pw"), "UTF-8")).toCharArray();
			}

		}
		catch (Throwable e)
		{
			COConfigurationManager.setParameter("swt.auth.persistent.cache", new HashMap());
			Debug.printStackTrace(e);
		}
	}

	protected void saveAuthCache()
	{
		this_mon.enter();
		HashMap map = new HashMap();
		Iterator it = auth_cache.values().iterator();
		do
		{
			if (!it.hasNext())
				break;
			authCache value = (authCache)it.next();
			if (value.isPersistent())
				try
				{
					HashMap entry_map = new HashMap();
					entry_map.put("user", value.getAuth().getUserName().getBytes("UTF-8"));
					entry_map.put("pw", (new String(value.getAuth().getPassword())).getBytes("UTF-8"));
					map.put(value.getKey(), entry_map);
				}
				catch (Throwable e)
				{
					Debug.printStackTrace(e);
				}
		} while (true);
		COConfigurationManager.setParameter("swt.auth.persistent.cache", map);
		this_mon.exit();
		break MISSING_BLOCK_LABEL_165;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public void clearPasswords()
	{
		this_mon.enter();
		auth_cache = new HashMap();
		saveAuthCache();
		this_mon.exit();
		break MISSING_BLOCK_LABEL_42;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public PasswordAuthentication getAuthentication(String realm, URL tracker)
	{
		PasswordAuthentication passwordauthentication;
		this_mon.enter();
		passwordauthentication = getAuthentication(realm, tracker.getProtocol(), tracker.getHost(), tracker.getPort());
		this_mon.exit();
		return passwordauthentication;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public void setAuthenticationOutcome(String realm, URL tracker, boolean success)
	{
		this_mon.enter();
		setAuthenticationOutcome(realm, tracker.getProtocol(), tracker.getHost(), tracker.getPort(), success);
		this_mon.exit();
		break MISSING_BLOCK_LABEL_47;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public void setAuthenticationOutcome(String realm, String protocol, String host, int port, boolean success)
	{
		this_mon.enter();
		String tracker = (new StringBuilder()).append(protocol).append("://").append(host).append(":").append(port).append("/").toString();
		String auth_key = (new StringBuilder()).append(realm).append(":").append(tracker).toString();
		authCache cache = (authCache)auth_cache.get(auth_key);
		if (cache != null)
			cache.setOutcome(success);
		this_mon.exit();
		break MISSING_BLOCK_LABEL_123;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public PasswordAuthentication getAuthentication(String realm, String protocol, String host, int port)
	{
		String tracker;
		this_mon.enter();
		tracker = (new StringBuilder()).append(protocol).append("://").append(host).append(":").append(port).append("/").toString();
		InetAddress bind_ip = NetworkAdmin.getSingleton().getSingleHomedServiceBindAddress();
		String self_addr;
		if (bind_ip == null || bind_ip.isAnyLocalAddress())
			self_addr = "127.0.0.1";
		else
			self_addr = bind_ip.getHostAddress();
		if (!host.equals(self_addr) && !host.equals(COConfigurationManager.getStringParameter("Tracker IP", "")))
			break MISSING_BLOCK_LABEL_162;
		PasswordAuthentication passwordauthentication;
		byte pw[] = COConfigurationManager.getByteParameter("Tracker Password", new byte[0]);
		String str_pw = new String(Base64.encode(pw));
		passwordauthentication = new PasswordAuthentication("<internal>", str_pw.toCharArray());
		this_mon.exit();
		return passwordauthentication;
		Throwable e;
		e;
		Debug.printStackTrace(e);
		String auth_key;
		PasswordAuthentication passwordauthentication1;
		auth_key = (new StringBuilder()).append(realm).append(":").append(tracker).toString();
		authCache cache = (authCache)auth_cache.get(auth_key);
		if (cache == null)
			break MISSING_BLOCK_LABEL_235;
		PasswordAuthentication auth = cache.getAuth();
		if (auth == null)
			break MISSING_BLOCK_LABEL_235;
		passwordauthentication1 = auth;
		this_mon.exit();
		return passwordauthentication1;
		String res[];
		res = getAuthenticationDialog(realm, tracker);
		if (res != null)
			break MISSING_BLOCK_LABEL_262;
		passwordauthentication1 = null;
		this_mon.exit();
		return passwordauthentication1;
		PasswordAuthentication passwordauthentication2;
		PasswordAuthentication auth = new PasswordAuthentication(res[0], res[1].toCharArray());
		boolean save_pw = res[2].equals("true");
		boolean old_entry_existed = auth_cache.put(auth_key, new authCache(auth_key, auth, save_pw)) != null;
		if (save_pw || old_entry_existed)
			saveAuthCache();
		passwordauthentication2 = auth;
		this_mon.exit();
		return passwordauthentication2;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	protected String[] getAuthenticationDialog(final String realm, final String location)
	{
		final Display display = SWTThread.getInstance().getDisplay();
		if (display.isDisposed())
			return null;
		final AESemaphore sem = new AESemaphore("SWTAuth");
		final authDialog dialog[] = new authDialog[1];
		org.gudy.azureus2.core3.torrent.TOTorrent torrent = TorrentUtils.getTLSTorrent();
		final boolean is_tracker;
		final String details;
		if (torrent == null)
		{
			is_tracker = false;
			details = TorrentUtils.getTLSDescription();
		} else
		{
			details = TorrentUtils.getLocalisedName(torrent);
			is_tracker = true;
		}
		try
		{
			display.asyncExec(new AERunnable() {

				final authDialog val$dialog[];
				final AESemaphore val$sem;
				final Display val$display;
				final String val$realm;
				final boolean val$is_tracker;
				final String val$location;
				final String val$details;
				final AuthenticatorWindow this$0;

				public void runSupport()
				{
					dialog[0] = new authDialog(sem, display, realm, is_tracker, location, details);
				}

			
			{
				this$0 = AuthenticatorWindow.this;
				dialog = aauthdialog;
				sem = aesemaphore;
				display = display1;
				realm = s;
				is_tracker = flag;
				location = s1;
				details = s2;
				AERunnable();
			}
			});
		}
		catch (Throwable e)
		{
			Debug.printStackTrace(e);
			return null;
		}
		sem.reserve();
		String user = dialog[0].getUsername();
		String pw = dialog[0].getPassword();
		String persist = dialog[0].savePassword() ? "true" : "false";
		if (user == null)
			return null;
		else
			return (new String[] {
				user, pw != null ? pw : "", persist
			});
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -