简体   繁体   中英

Smack login with md5 hashed password to Openfire

How can I login with MD5 hashed password to openfire?

I'm using smack 4.0.4.

I've tried DIGEST-MD5 registiration but it's not work

SASLAuthentication.registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class); 
SASLAuthentication.supportSASLMechanism("DIGEST-MD5");

I'm getting this error :

SASLError using PLAIN: not-authorized

My code looks like this:

config = new ConnectionConfiguration(xmppServerAddress, Integer.parseInt(xmppServerPort));
config.setDebuggerEnabled(true);
config.setReconnectionAllowed(true);    
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
XMPPTCPConnection connectionTmp = new XMPPTCPConnection(config);
connectionTmp.connect();

connectionTmp.login("username","md5hashedpassword");

I have a similar problem, you could check if your password is in md5.

I have generate a passwords from the userid (long type) as:

@Override
    public String generatePassword(long userId) {
        String userIdString = String.valueOf(userId);
        return MD5util.getMD5(userIdString + StringUtil.getStringAlternateCharacters(userIdString));
    }

or find out that your xmpp server (openfire) IP is correctly configured as you wish to login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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