private synchronized void sendAuthResponse(Element inbound) throws IOException
        {
            if (encryptionPolicy == Connection.TLSPolicy.disabled) {
                isAuthenticated = false;

                final Document outbound = DocumentHelper.createDocument();
                final Element failure = outbound.addElement(QName.get("failure", "urn:ietf:params:xml:ns:xmpp-sasl"));
                failure.addElement(QName.get("not-authorized"));

                send(failure.asXML());
            }

            if (!(socket instanceof SSLSocket)) {
                final Document outbound = DocumentHelper.createDocument();
                final Element failure = outbound.addElement(QName.get("failure", "urn:ietf:params:xml:ns:xmpp-sasl"));
                failure.addElement(QName.get("encryption-required"));

                send(failure.asXML());
            }

            final X509Certificate[] peerCertificates = (X509Certificate[]) ((SSLSocket) socket).getSession().getPeerCertificates();
            if (peerCertificates == null || peerCertificates.length == 0 || Instant.now().isAfter(peerCertificates[0].getNotAfter().toInstant()) || Instant.now().isBefore(peerCertificates[0].getNotBefore().toInstant())) {
                final Document outbound = DocumentHelper.createDocument();
                final Element failure = outbound.addElement(QName.get("failure", "urn:ietf:params:xml:ns:xmpp-sasl"));
                failure.addElement(QName.get("not-authorized"));

                send(failure.asXML());
            }


            isAuthenticated = true;
            final Document root = DocumentHelper.createDocument();
            root.addElement(QName.get("success", "urn:ietf:params:xml:ns:xmpp-sasl"));
            send(root.getRootElement().asXML());
        }
Responds to a SASL auth request with a SASL result indicating that authentication succeeded.

Very basic verification is performed by this implementation: if the peer provides a certificate that's not expired, authentication is accepted.

If TLS is disabled, this sends an authentication failure response.

@param inbound The SASL request to authenticate.
xmppserver/src/test/java/org/jivesoftware/openfire/session/RemoteReceivingServerDummy.java