📄 authenticatorwindow.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: AuthenticatorWindow.java
package org.gudy.azureus2.ui.swt.auth;
import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin;
import com.aelitis.azureus.ui.common.RememberedDecisionsManager;
import java.net.*;
import java.util.*;
import org.bouncycastle.util.encoders.Base64;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.security.SEPasswordListener;
import org.gudy.azureus2.core3.security.SESecurityManager;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;
public class AuthenticatorWindow
implements SEPasswordListener
{
protected class authCache
{
private String key;
private PasswordAuthentication auth;
private boolean persist;
private int life;
private boolean succeeded;
final AuthenticatorWindow this$0;
protected String getKey()
{
return key;
}
protected boolean isPersistent()
{
return persist;
}
protected void setOutcome(boolean success)
{
if (success)
{
succeeded = true;
} else
{
if (persist)
{
persist = false;
saveAuthCache();
}
if (!succeeded)
auth = null;
}
}
protected PasswordAuthentication getAuth()
{
if (succeeded)
return auth;
life--;
if (life >= 0)
return auth;
if (persist)
{
persist = false;
saveAuthCache();
}
return null;
}
protected authCache(String _key, PasswordAuthentication _auth, boolean _persist)
{
this$0 = AuthenticatorWindow.this;
Object();
life = 5;
key = _key;
auth = _auth;
persist = _persist;
}
}
protected class authDialog
{
private Shell shell;
private AESemaphore sem;
private String username;
private String password;
private boolean persist;
final AuthenticatorWindow this$0;
protected void close(boolean ok)
{
if (ok)
{
if (username == null)
username = "";
if (password == null)
password = "";
} else
{
username = null;
password = null;
}
shell.dispose();
sem.release();
}
protected String getUsername()
{
return username;
}
protected String getPassword()
{
return password;
}
protected boolean savePassword()
{
return persist;
}
protected authDialog(AESemaphore _sem, Display display, String realm, boolean is_tracker, String target, String details)
{
this$0 = AuthenticatorWindow.this;
Object();
sem = _sem;
if (display.isDisposed())
{
sem.release();
return;
}
final String ignore_key = (new StringBuilder()).append("IgnoreAuth:").append(realm).append(":").append(target).append(":").append(details).toString();
if (RememberedDecisionsManager.getRememberedDecision(ignore_key) == 1)
{
Debug.out((new StringBuilder()).append("Authentication for ").append(realm).append("/").append(target).append("/").append(details).append(" ignored as told not to ask again").toString());
sem.release();
return;
}
shell = new Shell(display, 0x10860);
Utils.setShellIcon(shell);
Messages.setLanguageText(shell, "authenticator.title");
GridLayout layout = new GridLayout();
layout.numColumns = 3;
shell.setLayout(layout);
Label realm_label = new Label(shell, 0);
Messages.setLanguageText(realm_label, "authenticator.realm");
GridData gridData = new GridData(1808);
gridData.horizontalSpan = 1;
realm_label.setLayoutData(gridData);
Label realm_value = new Label(shell, 0);
realm_value.setText(realm.replaceAll("&", "&&"));
gridData = new GridData(1808);
gridData.horizontalSpan = 2;
realm_value.setLayoutData(gridData);
Label target_label = new Label(shell, 0);
Messages.setLanguageText(target_label, is_tracker ? "authenticator.tracker" : "authenticator.location");
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
target_label.setLayoutData(gridData);
Label target_value = new Label(shell, 0);
target_value.setText(target.replaceAll("&", "&&"));
gridData = new GridData(1808);
gridData.horizontalSpan = 2;
target_value.setLayoutData(gridData);
if (details != null)
{
Label details_label = new Label(shell, 0);
Messages.setLanguageText(details_label, is_tracker ? "authenticator.torrent" : "authenticator.details");
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
details_label.setLayoutData(gridData);
Label details_value = new Label(shell, 0);
details_value.setText(details.replaceAll("&", "&&"));
gridData = new GridData(1808);
gridData.horizontalSpan = 2;
details_value.setLayoutData(gridData);
}
Label user_label = new Label(shell, 0);
Messages.setLanguageText(user_label, "authenticator.user");
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
user_label.setLayoutData(gridData);
final Text user_value = new Text(shell, 2048);
user_value.setText("");
gridData = new GridData(1808);
gridData.horizontalSpan = 2;
user_value.setLayoutData(gridData);
user_value.addListener(24, new Listener() {
final AuthenticatorWindow val$this$0;
final Text val$user_value;
final authDialog this$1;
public void handleEvent(Event event)
{
username = user_value.getText();
}
// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
});
Label password_label = new Label(shell, 0);
Messages.setLanguageText(password_label, "authenticator.password");
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
password_label.setLayoutData(gridData);
final Text password_value = new Text(shell, 2048);
password_value.setEchoChar('*');
password_value.setText("");
gridData = new GridData(1808);
gridData.horizontalSpan = 2;
password_value.setLayoutData(gridData);
password_value.addListener(24, new Listener() {
final AuthenticatorWindow val$this$0;
final Text val$password_value;
final authDialog this$1;
public void handleEvent(Event event)
{
password = password_value.getText();
}
// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
});
Label blank_label = new Label(shell, 0);
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
blank_label.setLayoutData(gridData);
final Button checkBox = new Button(shell, 32);
checkBox.setText(MessageText.getString("authenticator.savepassword"));
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
checkBox.setLayoutData(gridData);
checkBox.addListener(13, new Listener() {
final AuthenticatorWindow val$this$0;
final Button val$checkBox;
final authDialog this$1;
public void handleEvent(Event e)
{
persist = checkBox.getSelection();
}
// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
});
final Button dontAsk = new Button(shell, 32);
dontAsk.setText(MessageText.getString("general.dont.ask.again"));
gridData = new GridData(1808);
gridData.horizontalSpan = 1;
dontAsk.setLayoutData(gridData);
dontAsk.addListener(13, new Listener() {
final AuthenticatorWindow val$this$0;
final String val$ignore_key;
final Button val$dontAsk;
final authDialog this$1;
public void handleEvent(Event e)
{
RememberedDecisionsManager.setRemembered(ignore_key, dontAsk.getSelection() ? 1 : 0);
}
// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
});
Label labelSeparator = new Label(shell, 258);
gridData = new GridData(768);
gridData.horizontalSpan = 3;
labelSeparator.setLayoutData(gridData);
new Label(shell, 0);
Button bOk = new Button(shell, 8);
Messages.setLanguageText(bOk, "Button.ok");
gridData = new GridData(896);
gridData.grabExcessHorizontalSpace = true;
gridData.widthHint = 70;
bOk.setLayoutData(gridData);
bOk.addListener(13, new Listener() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -