/** * Add the given mechanism to the enabled ones. See {@link #addEnabledSaslMechanism(Collection)} for a discussion about enabled SASL mechanisms. * * @param saslMechanism the name of the mechanism to enable. * @return a reference to this builder. */ public B addEnabledSaslMechanism(String saslMechanism) { return addEnabledSaslMechanism(Arrays.asList(StringUtils.requireNotNullNorEmpty(saslMechanism, "saslMechanism must not be null nor empty"))); }
/** * Perform anonymous authentication using SASL ANONYMOUS. Your XMPP service must support this authentication * mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "ANONYMOUS" as argument. * * @return a reference to this builder. */ public B performSaslAnonymousAuthentication() { if (!SASLAuthentication.isSaslMechanismRegistered(SASLAnonymous.NAME)) { throw new IllegalArgumentException("SASL " + SASLAnonymous.NAME + " is not registered"); } throwIfEnabledSaslMechanismsSet(); allowEmptyOrNullUsernames(); addEnabledSaslMechanism(SASLAnonymous.NAME); saslMechanismsSealed = true; return getThis(); }
/** * Perform authentication using SASL EXTERNAL. Your XMPP service must support this * authentication mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "EXTERNAL" as * argument. It also calls {@link #allowEmptyOrNullUsernames()} and {@link #setSecurityMode(ConnectionConfiguration.SecurityMode)} to * {@link SecurityMode#required}. * * @param sslContext custom SSLContext to be used. * @return a reference to this builder. */ public B performSaslExternalAuthentication(SSLContext sslContext) { if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) { throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered"); } setCustomSSLContext(sslContext); throwIfEnabledSaslMechanismsSet(); allowEmptyOrNullUsernames(); setSecurityMode(SecurityMode.required); addEnabledSaslMechanism(SASLMechanism.EXTERNAL); saslMechanismsSealed = true; return getThis(); }
/** * Perform authentication using SASL EXTERNAL. Your XMPP service must support this * authentication mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "EXTERNAL" as * argument. It also calls {@link #allowEmptyOrNullUsernames()} and {@link #setSecurityMode(ConnectionConfiguration.SecurityMode)} to * {@link SecurityMode#required}. * * @param sslContext custom SSLContext to be used. * @return a reference to this builder. */ public B performSaslExternalAuthentication(SSLContext sslContext) { if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) { throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered"); } setCustomSSLContext(sslContext); throwIfEnabledSaslMechanismsSet(); allowEmptyOrNullUsernames(); setSecurityMode(SecurityMode.required); addEnabledSaslMechanism(SASLMechanism.EXTERNAL); saslMechanismsSealed = true; return getThis(); }
/** * Perform anonymous authentication using SASL ANONYMOUS. Your XMPP service must support this authentication * mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "ANONYMOUS" as argument. * * @return a reference to this builder. */ public B performSaslAnonymousAuthentication() { if (!SASLAuthentication.isSaslMechanismRegistered(SASLAnonymous.NAME)) { throw new IllegalArgumentException("SASL " + SASLAnonymous.NAME + " is not registered"); } throwIfEnabledSaslMechanismsSet(); allowEmptyOrNullUsernames(); addEnabledSaslMechanism(SASLAnonymous.NAME); saslMechanismsSealed = true; return getThis(); }
/** * Add the given mechanism to the enabled ones. See {@link #addEnabledSaslMechanism(Collection)} for a discussion about enabled SASL mechanisms. * * @param saslMechanism the name of the mechanism to enable. * @return a reference to this builder. */ public B addEnabledSaslMechanism(String saslMechanism) { return addEnabledSaslMechanism(Arrays.asList(StringUtils.requireNotNullOrEmpty(saslMechanism, "saslMechanism must not be null or empty"))); }