繁体   English   中英

尝试使用Smack登录XMPP服务器导致SASL“未授权”

[英]Trying to log into XMPP server using Smack results in SASL “not authorized”

我正在尝试使用Smack登录XMPP服务器。 尝试登录时,我收到以下错误:

SASL身份验证PLAIN失败:未经授权

我已经能够使用具有相同凭据的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连接时选择“Legacy SSL”,但我不知道如何在Java中做到这一点。

谢谢你的帮助

尝试在用户名中没有域部分的login()

connection.login("user", "password");

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM