The registerSASLMechanism call in the top comment can be avoided by applying this patch:
Index: /scratch/svn/jivesoftware/smack/source/org/jivesoftware/smack/SASLAuthentication.java
===================================================================
— /scratch/svn/jivesoftware/smack/source/org/jivesoftware/smack/SASLAuthentication.java (revision 4007)
+++ /scratch/svn/jivesoftware/smack/source/org/jivesoftware/smack/SASLAuthentication.java (working copy)
@@ -27,6 +27,7 @@
import org.jivesoftware.smack.sasl.SASLAnonymous;
import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.sasl.SASLPlainMechanism;
+import org.jivesoftware.smack.sasl.SASLGSSAPIMechanism;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -42,7 +43,7 @@
- fails then Non-SASL will be tried.<p>
- The server may support many SASL mechanisms to use for authenticating. Out of the box
- * Smack provides SASL PLAIN but it is possible to register new SASL Mechanisms. Use
+ * Smack provides SASL PLAIN and GSSAPI but it is possible to register new SASL Mechanisms. Use
static
{
// Register SASL mechanisms supported by Smack
- registerSASLMechanism(0, "PLAIN", SASLPlainMechanism.class);
+ registerSASLMechanism(0, "GSSAPI", SASLGSSAPIMechanism.class);
+ // registerSASLMechanism(1, "PLAIN", SASLPlainMechanism.class);
}
/**
I attached a class that makes it work. Use it like this:
[code]
XMPPConnection connection = new XMPPConnection("jabber.domain.com");
connection.getSASLAuthentication().registerSASLMechanism(0,"GSSAPI",SASLGSSAPIMechanism.class);
connection.login("jay",""); //password gets ignored, but is required
connection.createChat("jay@jabber.domain.com").sendMessage("Howdy!");
[/code]
You need to have a JASS config file (gss.conf) that looks kinda like this:
[code]
/**
*/
com.sun.security.jgss.initiate {
com.sun.security.auth.module.Krb5LoginModule required doNotPrompt=true useTicketCache=true;
};
[/code]