aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2015-01-20 19:28:31 +0100
committerDanny van Heumen <danny@dannyvanheumen.nl>2015-04-03 21:37:01 +0200
commit89e35bf75c3420553ebbf6efbbff3c4d6f55ee05 (patch)
tree844d6189f0e044808c251de967ca8953ff643926
parent71d61592c32789006d31c297ddf35d95c973924c (diff)
downloadjitsi-89e35bf75c3420553ebbf6efbbff3c4d6f55ee05.zip
jitsi-89e35bf75c3420553ebbf6efbbff3c4d6f55ee05.tar.gz
jitsi-89e35bf75c3420553ebbf6efbbff3c4d6f55ee05.tar.bz2
Started work on SASL authentication panel in IRC account configuration.
-rw-r--r--lib/installer-exclude/irc-api-1.0.jarbin208816 -> 221304 bytes
-rw-r--r--resources/languages/resources.properties3
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/IrcConnection.java23
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java20
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java12
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java66
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java44
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java42
9 files changed, 200 insertions, 11 deletions
diff --git a/lib/installer-exclude/irc-api-1.0.jar b/lib/installer-exclude/irc-api-1.0.jar
index 6a0e2d7..3ebab88 100644
--- a/lib/installer-exclude/irc-api-1.0.jar
+++ b/lib/installer-exclude/irc-api-1.0.jar
Binary files differ
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index fd1ccab..c4b9789 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -1096,6 +1096,9 @@ plugin.ircaccregwizz.EXAMPLE_SERVER=Ex: chat.freenode.net
plugin.ircaccregwizz.USE_SECURE_CONNECTION=Use secure connection
plugin.ircaccregwizz.ENABLE_CONTACT_PRESENCE=Enable contact presence
plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE=Enable chat room presence
+plugin.ircaccregwizz.SASL_AUTHENTICATION_TITLE=SASL authentication
+plugin.ircaccregwizz.ENABLE_SASL_AUTHENTICATION=Enable SASL authentication
+plugin.ircaccregwizz.SASL_AUTHZ_ROLE=Role
# jabber accregwizz
plugin.jabberaccregwizz.PROTOCOL_NAME=XMPP
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcConnection.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcConnection.java
index 09b7f83..5c56e6e 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/IrcConnection.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcConnection.java
@@ -218,8 +218,31 @@ public class IrcConnection
}
else
{
+ // FIXME correctly determine capabilities and SASL authentication
+ // enabled
return new SaslNegotiator(user, password, null);
}
+ // FIXME DEBUG CODE remove
+// final ArrayList<Capability> caps = new ArrayList<Capability>();
+// caps.add(new SimpleCapability("away-notify"));
+// if (password != null)
+// {
+// caps.add(new SaslCapability(true, null, user, password));
+// }
+// return new CompositeNegotiator(caps, new CompositeNegotiator.Host()
+// {
+// @Override
+// public void reject(Capability cap)
+// {
+// LOGGER.warn("REJECTED: " + cap.getId());
+// }
+//
+// @Override
+// public void acknowledge(Capability cap)
+// {
+// LOGGER.warn("ACKED: " + cap.getId());
+// }
+// });
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
index fb8e0ef..e599440 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java
@@ -37,6 +37,26 @@ public class ProtocolProviderFactoryIrcImpl
public static final String CONTACT_PRESENCE_TASK = "CONTACT_PRESENCE_TASK";
/**
+ * Property indicating SASL is enabled.
+ */
+ public static final String SASL_ENABLED = "SASL_ENABLED";
+
+ /**
+ * Property for SASL user name.
+ */
+ public static final String SASL_USERNAME = "SASL_USERNAME";
+
+ /**
+ * Property for SASL password.
+ */
+ public static final String SASL_PASSWORD = "SASL_PASSWORD";
+
+ /**
+ * Property for SASL authorization role.
+ */
+ public static final String SASL_ROLE = "SASL_ROLE";
+
+ /**
* Constructor.
*/
public ProtocolProviderFactoryIrcImpl()
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
index cc2261c..78eb485 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
@@ -264,6 +264,15 @@ public class ProtocolProviderServiceIrcImpl
accountID.getAccountPropertyBoolean(
ProtocolProviderFactoryIrcImpl.CONTACT_PRESENCE_TASK, true);
+ boolean saslEnabled = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactoryIrcImpl.SASL_ENABLED, false);
+ String saslUser = accountID.getAccountPropertyString(
+ ProtocolProviderFactoryIrcImpl.SASL_USERNAME);
+ String saslPass = accountID.getAccountPropertyString(
+ ProtocolProviderFactoryIrcImpl.SASL_PASSWORD);
+ String saslRole = accountID.getAccountPropertyString(
+ ProtocolProviderFactoryIrcImpl.SASL_ROLE);
+
//if we don't - retrieve it from the user through the security authority
if (serverPassword == null && passwordRequired)
{
@@ -388,7 +397,8 @@ public class ProtocolProviderServiceIrcImpl
IrcActivator.getConfigurationService();
if (configSvc == null)
{
- return false;
+ // Assuming maximum use of configured proxy server is desirable.
+ return true;
}
// FIXME implement support for option to enable SOCKS5 DNS resolving
return true;
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
index 8ae471e..88c1bce 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
@@ -25,5 +25,6 @@ Import-Package: org.osgi.framework,
com.ircclouds.irc.api.state,
com.ircclouds.irc.api.commands,
com.ircclouds.irc.api.negotiators,
+ com.ircclouds.irc.api.negotiators.capabilities,
org.apache.commons.lang3,
org.apache.commons.codec.binary
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
index 92d2cd3..7d97143 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
@@ -61,6 +61,8 @@ public class FirstWizardPage
private JPanel serverPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel optionsPanel = new TransparentPanel(new BorderLayout(10, 10));
+
+ private JPanel saslPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new TransparentPanel();
@@ -127,6 +129,15 @@ public class FirstWizardPage
private JCheckBox enableChatRoomPresenceTask = new SIPCommCheckBox(
Resources.getString("plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE"));
+ private JCheckBox saslEnabled = new SIPCommCheckBox(
+ Resources.getString("plugin.ircaccregwizz.ENABLE_SASL_AUTHENTICATION"));
+
+ private JTextField saslUserIdField = new JTextField();
+
+ private JPasswordField saslPasswordField = new JPasswordField();
+
+ private JTextField saslRoleField = new JTextField();
+
private JPanel mainPanel = new TransparentPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
@@ -223,18 +234,14 @@ public class FirstWizardPage
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
-// labelsPanel.add(server);
-
valuesPanel.add(userIDField);
valuesPanel.add(nickExampleLabel);
valuesPanel.add(passField);
-// valuesPanel.add(serverField);
userPassPanel.add(infoPassword, BorderLayout.NORTH);
userPassPanel.add(labelsPanel, BorderLayout.WEST);
userPassPanel.add(valuesPanel, BorderLayout.CENTER);
userPassPanel.add(passwordNotRequired, BorderLayout.SOUTH);
-// userPassPanel.add(autoChangeNick, BorderLayout.SOUTH);
userPassPanel.setBorder(BorderFactory
.createTitledBorder(Resources.getString(
@@ -271,15 +278,39 @@ public class FirstWizardPage
optionsPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("service.gui.OPTIONS")));
+ saslPanel.add(this.saslEnabled, BorderLayout.NORTH);
+
+ TransparentPanel saslControlsPanel = new TransparentPanel();
+ saslControlsPanel.setLayout(new BoxLayout(saslControlsPanel, BoxLayout.Y_AXIS));
+ saslPanel.add(saslControlsPanel, BorderLayout.CENTER);
+
+ JLabel saslUserLabel = new JLabel(Resources.getString("plugin.ircaccregwizz.USERNAME") + ":");
+ saslControlsPanel.add(horizontal(100, saslUserLabel, saslUserIdField));
+ JLabel saslPassLabel = new JLabel(Resources.getString("service.gui.PASSWORD") + ":");
+ saslControlsPanel.add(horizontal(100, saslPassLabel, saslPasswordField));
+ JLabel saslRoleLabel = new JLabel(Resources.getString("plugin.ircaccregwizz.SASL_AUTHZ_ROLE") + ":");
+ saslControlsPanel.add(horizontal(100, saslRoleLabel, saslRoleField));
+
+ // FIXME continue implementation of the sasl authentication panel
+
+ saslPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("plugin.ircaccregwizz.SASL_AUTHENTICATION_TITLE")));
+
mainPanel.add(userPassPanel);
mainPanel.add(serverPanel);
mainPanel.add(optionsPanel);
+ mainPanel.add(saslPanel);
this.add(mainPanel, BorderLayout.NORTH);
-// this.add(serverPanel, BorderLayout.SOUTH);
-// this.add(optionsPanel, BorderLayout.AFTER_LAST_LINE);
}
+ private JPanel horizontal(int width, Component cmp1, Component cmp2) {
+ TransparentPanel panel = new TransparentPanel(new BorderLayout(10, 10));
+ cmp1.setPreferredSize(new Dimension(width, cmp1.getHeight()));
+ panel.add(cmp1, BorderLayout.WEST);
+ panel.add(cmp2, BorderLayout.CENTER);
+ return panel;
+ }
/**
* Implements the <code>WizardPage.getIdentifier</code> to return
* this page identifier.
@@ -364,6 +395,10 @@ public class FirstWizardPage
.isSelected());
registration.setChatRoomPresenceTaskEnabled(enableChatRoomPresenceTask
.isSelected());
+ registration.setSaslEnabled(this.saslEnabled.isSelected());
+ registration.setSaslUser(this.saslUserIdField.getText());
+ registration.setSaslPass(new String(saslPasswordField.getPassword()));
+ registration.setSaslRole(this.saslRoleField.getText());
isCommitted = true;
}
@@ -475,6 +510,20 @@ public class FirstWizardPage
accountID.getAccountPropertyBoolean(
IrcAccountRegistrationWizard.CHAT_ROOM_PRESENCE_TASK, true);
+ final boolean enableSaslAuthentication =
+ accountID.getAccountPropertyBoolean(
+ IrcAccountRegistrationWizard.SASL_ENABLED, false);
+ final String saslUser =
+ accountID.getAccountPropertyString(
+ IrcAccountRegistrationWizard.SASL_USERNAME, "");
+ // FIXME load password from secure password storage!
+ final String saslPass =
+ accountID.getAccountPropertyString(
+ IrcAccountRegistrationWizard.SASL_PASSWORD, "");
+ final String saslRole =
+ accountID.getAccountPropertyString(
+ IrcAccountRegistrationWizard.SASL_ROLE, "");
+
this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
this.serverField.setText(server);
@@ -516,6 +565,11 @@ public class FirstWizardPage
this.enableContactPresenceTask.setSelected(contactPresenceTaskEnabled);
this.enableChatRoomPresenceTask
.setSelected(chatRoomPresenceTaskEnabled);
+
+ this.saslEnabled.setSelected(enableSaslAuthentication);
+ this.saslUserIdField.setText(saslUser);
+ this.saslPasswordField.setText(saslPass);
+ this.saslRoleField.setText(saslRole);
}
/**
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
index ef2a5e0..d10f3d4 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
@@ -23,6 +23,10 @@ public class IrcAccountRegistration
private boolean autoChangeNick;
private boolean isRequiredPassword;
private boolean secureConnection;
+ private boolean saslEnabled;
+ private String saslUser;
+ private String saslPass;
+ private String saslRole;
/**
* Option for activating contact presence task.
@@ -242,4 +246,44 @@ public class IrcAccountRegistration
{
this.chatroomPresenceTaskEnabled = value;
}
+
+ public boolean isSaslEnabled()
+ {
+ return this.saslEnabled;
+ }
+
+ public void setSaslEnabled(final boolean enabled)
+ {
+ this.saslEnabled = enabled;
+ }
+
+ public String getSaslUser()
+ {
+ return this.saslUser;
+ }
+
+ public void setSaslUser(final String user)
+ {
+ this.saslUser = user;
+ }
+
+ public String getSaslPass()
+ {
+ return this.saslPass;
+ }
+
+ public void setSaslPass(final String pass)
+ {
+ this.saslPass = pass;
+ }
+
+ public String getSaslRole()
+ {
+ return this.saslRole;
+ }
+
+ public void setSaslRole(final String role)
+ {
+ this.saslRole = role;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
index 76ccdef..9c2f173 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
@@ -47,6 +47,26 @@ public class IrcAccountRegistrationWizard
public static final String CHAT_ROOM_PRESENCE_TASK =
"CHAT_ROOM_PRESENCE_TASK";
+ /**
+ * Property indicating SASL is enabled.
+ */
+ public static final String SASL_ENABLED = "SASL_ENABLED";
+
+ /**
+ * Property name for SASL user.
+ */
+ public static final String SASL_USERNAME = "SASL_USERNAME";
+
+ /**
+ * Property name for SASL password.
+ */
+ public static final String SASL_PASSWORD = "SASL_PASSWORD";
+
+ /**
+ * Property for SASL authorization role.
+ */
+ public static final String SASL_ROLE = "SASL_ROLE";
+
private final Logger logger
= Logger.getLogger(IrcAccountRegistrationWizard.class);
@@ -190,6 +210,15 @@ public class IrcAccountRegistrationWizard
summaryTable.put(Resources
.getString("plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE"),
registration.isChatRoomPresenceTaskEnabled() ? yes : no);
+ summaryTable.put(Resources
+ .getString("plugin.ircaccregwizz.ENABLE_SASL_AUTHENTICATION"),
+ registration.isSaslEnabled() ? yes : no);
+ summaryTable.put(
+ "SASL " + Resources.getString("plugin.ircaccregwizz.USERNAME"),
+ registration.getSaslUser());
+ summaryTable.put("SASL "
+ + Resources.getString("plugin.ircaccregwizz.SASL_AUTHZ_ROLE"),
+ registration.getSaslRole());
return summaryTable.entrySet().iterator();
}
@@ -233,10 +262,7 @@ public class IrcAccountRegistrationWizard
{
ProtocolProviderFactory factory
= IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
-
- return this.installAccount(factory,
- userName,
- password);
+ return this.installAccount(factory, userName, password);
}
/**
@@ -282,11 +308,19 @@ public class IrcAccountRegistrationWizard
accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,
new Boolean(registration.isSecureConnection()).toString());
+ // Presence-based background tasks
accountProperties.put(CONTACT_PRESENCE_TASK,
Boolean.toString(registration.isContactPresenceTaskEnabled()));
accountProperties.put(CHAT_ROOM_PRESENCE_TASK,
Boolean.toString(registration.isChatRoomPresenceTaskEnabled()));
+ // SASL properties
+ accountProperties.put(SASL_ENABLED,
+ Boolean.toString(registration.isSaslEnabled()));
+ accountProperties.put(SASL_USERNAME, registration.getSaslUser());
+ accountProperties.put(SASL_PASSWORD, registration.getSaslPass());
+ accountProperties.put(SASL_ROLE, registration.getSaslRole());
+
if (isModification())
{
providerFactory.modifyAccount(this.protocolProvider,