Class StartTlsFilter

  • All Implemented Interfaces:
    org.apache.mina.core.filterchain.IoFilter

    public class StartTlsFilter
    extends org.apache.mina.core.filterchain.IoFilterAdapter
    A MINA filter that facilitates StartTLS negotiation over XMPP. When StartTLS is being negotiated, an instance of SslFilter is added to the MINA filter-chain. However, the peer also needs to be informed that TLS negotiation can commence, as per section 5.4.2.3 of RFC-6120. To prevent race conditions, the SSL filter should be set before the peer is told to proceed. However, telling the peer to proceed with TLS negotiation needs to happen in plain text, which won't happen if an SSL filter has been set. As a work-around to this chicken/egg problem, this filter evaluates the data that is sent to the peer prior to it being passed to the SSL filter. If the data exactly matches the XMPP 'proceed' element (used to instruct the peer to begin TLS negotiation), that data skips the SSL filter. Instances of this filter are best removed from the filter-chain when TLS has been negotiated, to prevent it from evaluating all data that is being sent (which would waste system resources).
    Author:
    Guus der Kinderen, guus.der.kinderen@gmail.com
    See Also:
    Section 5.4.2.3 of RFC-6120
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.mina.core.filterchain.IoFilter

        org.apache.mina.core.filterchain.IoFilter.NextFilter
    • Constructor Summary

      Constructors 
      Constructor Description
      StartTlsFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void filterWrite​(org.apache.mina.core.filterchain.IoFilter.NextFilter nextFilter, org.apache.mina.core.session.IoSession session, org.apache.mina.core.write.WriteRequest writeRequest)  
      • Methods inherited from class org.apache.mina.core.filterchain.IoFilterAdapter

        destroy, event, exceptionCaught, filterClose, init, inputClosed, messageReceived, messageSent, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
    • Constructor Detail

      • StartTlsFilter

        public StartTlsFilter()
    • Method Detail

      • filterWrite

        public void filterWrite​(org.apache.mina.core.filterchain.IoFilter.NextFilter nextFilter,
                                org.apache.mina.core.session.IoSession session,
                                org.apache.mina.core.write.WriteRequest writeRequest)
        Specified by:
        filterWrite in interface org.apache.mina.core.filterchain.IoFilter
        Overrides:
        filterWrite in class org.apache.mina.core.filterchain.IoFilterAdapter