java – 尝试使用Smack结果登录到XMPP服务器在SASL“未授权”

我试图使用Smack登录到XMPP服务器.当尝试登录时,我会收到以下错误消息:

SASL authentication PLAIN Failed: not-authorized

我已经能够使用相同凭据的PSI-IM连接并登录服务器.

这是我目前拥有的:

System.setProperty("smack.debugEnabled","true");
    XMPPConnection.DEBUG_ENABLED = true;

    SASLAuthentication.supportSASLMechanism("PLAIN",0);

    ConnectionConfiguration configuration = new ConnectionConfiguration("chat.bla.com",5223);
    configuration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
    configuration.setSocketFactory(new DummySSLSocketFactory());
    configuration.setSASLAuthenticationEnabled(true);
    configuration.setDebuggerEnabled(true);
    configuration.setServiceName("bla.net");

    Connection connection = new XMPPConnection(configuration);

    try {
        connection.connect();
        connection.login("user@bla.net","blablabla");
    } catch (XMPPException e) {
        e.printstacktrace();
    }

这是我使用的DummySSLSocketFactory:http://svn.igniterealtime.org/svn/repos/spark/tags/spark_2_5_3_s/src/java/org/jivesoftware/spark/util/DummySSLSocketFactory.java

我在想,问题是,当我通过PSI连接时,我需要选择“旧式SSL”,但我不知道如何在Java中进行这种操作.

感谢任何帮助

解决方法

尝试登录(),而不使用用户名中的域名部分:
connection.login("user","password");

connection.login("user@example.org","password");

相关文章

背景 阿里java开发规范是阿里巴巴总结多年来的最佳编程实践,...
# 前言 在面试这一篇我们介绍过[CountDownLatch和CyclicBarr...
多线程编程是每一个开发必知必会的技能,在实际项目中,为了...
背景 在我们系统中有这么一个需求,业务方会通过mq将一些用户...
# 前言 为了更好的进行开发和维护,我们都会对程序进行分层设...
前言 关于动态代理的一些知识,以及cglib与jdk动态代理的区别...