aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2016-08-07 09:46:01 -0500
committerSam Whited <sam@samwhited.com>2016-09-12 11:30:03 -0500
commit805717673c1277e7f6783b4f6e6827741c650619 (patch)
treee95a876f11ab2d311b0ba5c35b053404b2478846 /src/main/java/eu
parent75fcab31707cf73ec69207e1147ca911a6ded6ce (diff)
Support ANONYMOUS SASL
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/sasl/Anonymous.java28
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java3
2 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/Anonymous.java b/src/main/java/eu/siacs/conversations/crypto/sasl/Anonymous.java
new file mode 100644
index 00000000..4672bc1f
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/crypto/sasl/Anonymous.java
@@ -0,0 +1,28 @@
+package eu.siacs.conversations.crypto.sasl;
+
+import java.security.SecureRandom;
+
+import eu.siacs.conversations.entities.Account;
+import eu.siacs.conversations.xml.TagWriter;
+
+public class Anonymous extends SaslMechanism {
+
+ public Anonymous(TagWriter tagWriter, Account account, SecureRandom rng) {
+ super(tagWriter, account, rng);
+ }
+
+ @Override
+ public int getPriority() {
+ return 0;
+ }
+
+ @Override
+ public String getMechanism() {
+ return "ANONYMOUS";
+ }
+
+ @Override
+ public String getClientFirstMessage() {
+ return "";
+ }
+}
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 964444af..8ff02e46 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -55,6 +55,7 @@ import javax.net.ssl.X509TrustManager;
import de.duenndns.ssl.MemorizingTrustManager;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.XmppDomainVerifier;
+import eu.siacs.conversations.crypto.sasl.Anonymous;
import eu.siacs.conversations.crypto.sasl.DigestMd5;
import eu.siacs.conversations.crypto.sasl.External;
import eu.siacs.conversations.crypto.sasl.Plain;
@@ -841,6 +842,8 @@ public class XmppConnection implements Runnable {
saslMechanism = new Plain(tagWriter, account);
} else if (mechanisms.contains("DIGEST-MD5")) {
saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG());
+ } else if (mechanisms.contains("ANONYMOUS")) {
+ saslMechanism = new Anonymous(tagWriter, account, mXmppConnectionService.getRNG());
}
if (saslMechanism != null) {
final JSONObject keys = account.getKeys();