public KonConnection(EndpointServer server, PrivateKey privateKey, X509Certificate bridgeCert, boolean validateCertificate) { super(buildConfiguration(RESSOURCE, server, privateKey, bridgeCert, validateCertificate) ); // blacklist PLAIN mechanism SASLAuthentication.blacklistSASLMechanism("PLAIN"); // enable SM without resumption (XEP-0198) this.setUseStreamManagement(true); this.setUseStreamManagementResumption(false); }
public ConnectionManager(Context context, ConnectionStatusCallback statusCallback, CommunicationManager communicationManager) { this.statusCallback = statusCallback; this.communicationManager = communicationManager; smack = SmackAndroid.init(context); SASLAuthentication.registerSASLMechanism(GTalkOAuthSASLMechanism.NAME, GTalkOAuthSASLMechanism.class); SASLAuthentication .supportSASLMechanism(GTalkOAuthSASLMechanism.NAME, 0); ConnectionConfiguration configuration = new ConnectionConfiguration( "talk.google.com", 5222, "gmail.com"); configuration.setSASLAuthenticationEnabled(true); connection = new XMPPConnection(configuration); }
private XMPPConnection createConnection() throws XMPPException { for (final String type : this.saslAuthenticationTypes) { SASLAuthentication.supportSASLMechanism(type, 0); } final XMPPConnection connection = new XMPPConnection(this.configuration); connection.connect(); connection.login(this.userName, this.password); return connection; }
@Override public List<Exception> initialize() { SASLAuthentication.registerSASLMechanism(new SASLExternalMechanism()); SASLAuthentication.registerSASLMechanism(new SASLGSSAPIMechanism()); SASLAuthentication.registerSASLMechanism(new SASLDigestMD5Mechanism()); SASLAuthentication.registerSASLMechanism(new SASLCramMD5Mechanism()); SASLAuthentication.registerSASLMechanism(new SASLPlainMechanism()); return null; }
@Override public List<Exception> initialize() { SASLAuthentication.registerSASLMechanism(new SASLDigestMD5Mechanism()); SASLAuthentication.registerSASLMechanism(new SASLExternalMechanism()); SASLAuthentication.registerSASLMechanism(new SASLPlainMechanism()); return null; }
private XMPPConnection login(final Configuration config) throws IOException, XMPPException, SmackException, KeyManagementException, NoSuchAlgorithmException { final String serviceName = isNullOrEmpty(config.getString(CK_SERVICE_NAME)) ? config.getString(CK_HOSTNAME) : config.getString(CK_SERVICE_NAME); final XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder() .setHost(config.getString(CK_HOSTNAME)) .setPort(config.getInt(CK_PORT)) .setServiceName(serviceName) .setSendPresence(false); if (config.getBoolean(CK_ACCEPT_SELFSIGNED)) { TLSUtils.acceptAllCertificates(configBuilder); } final boolean requireSecurity = config.getBoolean(CK_REQUIRE_SECURITY); configBuilder.setSecurityMode(requireSecurity ? ConnectionConfiguration.SecurityMode.required : ConnectionConfiguration.SecurityMode.ifpossible); final XMPPTCPConnectionConfiguration connectionConfiguration = configBuilder.build(); if (LOG.isDebugEnabled()) { LOG.debug("Supported SASL authentications: {}", SASLAuthentication.getRegisterdSASLMechanisms()); LOG.debug("require_security: {}", requireSecurity); LOG.debug("Security mode: {}", connectionConfiguration.getSecurityMode()); LOG.debug("Socket factory: {}", connectionConfiguration.getSocketFactory()); LOG.debug("Keystore: {}", connectionConfiguration.getKeystorePath()); LOG.debug("Keystore type: {}", connectionConfiguration.getKeystoreType()); } final XMPPTCPConnection xmppConnection = new XMPPTCPConnection(connectionConfiguration); xmppConnection.connect(); xmppConnection.login(config.getString(CK_USERNAME), config.getString(CK_PASSWORD)); return xmppConnection; }
/** * Login creates a connection to the xmpp server and tries to login the * user, called from setProperties */ private void login() throws WNSException { try { log.debug("Trying to login"); SASLAuthentication auth = this.connection.getSASLAuthentication(); auth.authenticate(this.user, this.pwd, ""); log.debug("Logged in"); } catch (XMPPException e) { log.error("Login to XMPP server failed: " + e.toString()); throw new WNSException("Login to XMPP server failed "); } }
public static void register() { SASLAuthentication.registerSASLMechanism(NAME, SASLXFacebookPlatformMechanism.class); SASLAuthentication.supportSASLMechanism(NAME, 0); }
/** * Constructor. */ public SASLXFacebookPlatformMechanism(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLDigestMD5Mechanism(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLMechanism(SASLAuthentication saslAuthentication) { this.saslAuthentication = saslAuthentication; }
protected SASLAuthentication getSASLAuthentication() { return saslAuthentication; }
public SASLCramMD5Mechanism(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLExternalMechanism(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLAnonymous(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLPlainMechanism(SASLAuthentication saslAuthentication) { super(saslAuthentication); }
public SASLFacebookConnect(SASLAuthentication saslAuthentication) { super(saslAuthentication); }