powered by Jive Software

SASL Authentication error (servlet vs applet)

I’m having trouble logging into an openfire server run locally when using the following sanitized code in an applet.

XMPPConnection _connection;

public void init(){

ConnectionConfiguration configuration = new ConnectionConfiguration(“192.168.1.10”, 5222);

_connection = new XMPPConnection(configuration);

SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);

_connection.connect();

_connection.login(“user”,“user”);

}

I’ve tried with and without the SASLAuthentication line. This same code snippet works inside a servlet, with the same user and password, but the applet gives me the

SASL authentication DIGEST-MD5 failed: not-authorized: … exception @ the line number for the login line.

I can also login using spark without a problem. I have tried various combinations of signed and unsigned applets and servlets. I have tried with complex and simple passwords. I’ve tried running the code locally on the browser of the tomcat/openfire server, as well as remotely from another machine. I’ve even tried anonymous login (after ensuring it was enabled on the openfire server). Everything I’ve tried produces the same exception when run from within an applet. What am I doing wrong?

AFAIK you will need to sign your applet with exceptions in place for the network restrictions. This will mean an appropriate policy file to grant permission to make the network connections.