public SaslAuthFixBean() { super(); // fix SASL auth SASLAuthentication.supportSASLMechanism("PLAIN", 0); } }
@Override public XMPPConnection createConnection( final ConnectionConfiguration config) { config.setCallbackHandler(this); final XMPPConnection conn = new XMPPConnection(config); // This just adds oauth2 to the mechanisms we support. SASLAuthentication.supportSASLMechanism("X-OAUTH2"); return conn; }
SASLAuthentication.supportSASLMechanism("PLAIN", 0); String[] credentials = authToken.split(":");
SASLAuthentication.supportSASLMechanism("PLAIN", 0); connection.login(username, password);
public synchronized void sendTo(final String recipient, final String message) throws XMPPException { log.info(String.format("%s: %s", recipient, message)); XMPPConnection connection = new XMPPConnection(new ConnectionConfiguration("talk.google.com", 5222, "gmail.com")); if (connection.isConnected() == false) { connection.connect(); } if (connection.isAuthenticated() == false) { SASLAuthentication.supportSASLMechanism("PLAIN", 0); connection.login(userName, password); connection.sendPacket(new Presence(Presence.Type.available)); } Message jabberMessage = new Message(recipient, Message.Type.chat); jabberMessage.setBody(message); connection.sendPacket(jabberMessage); connection.disconnect(new Presence(Presence.Type.unavailable)); } }
SASLAuthentication.supportSASLMechanism("EXTERNAL"); config.setReconnectionAllowed(true); config.setRosterLoadedAtLogin(true);
SASLAuthentication.supportSASLMechanism("PLAIN"); config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled); xmppConnection = new XMPPConnection(config);