Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-325

Configuration of SSLSession cacheSize and sessionTimeout

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 2.0.0-M1
    • Integration
    • None

    Description

      The defaults values for session cache and timeout could lead to a large number of sessions being cached under a SSLContext.
      The is no way to set these values in SSLContextFactoryBean.

      Index: integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java
      ===================================================================
      — integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java (revision 487691)
      +++ integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java (working copy)
      @@ -76,6 +76,10 @@
      private String trustManagerFactoryProvider = null;
      private boolean trustManagerFactoryAlgorithmUseDefault = false;
      private ManagerFactoryParameters trustManagerFactoryParameters = null;
      + private int clientSessionCacheSize = -1;
      + private int clientSessionTimeout = -1;
      + private int serverSessionCacheSize = -1;
      + private int serverSessionTimeout = -1;

      protected Object createInstance() throws Exception

      { @@ -156,7 +160,27 @@ }

      context.init( keyManagers, trustManagers, secureRandom );
      +
      + if( clientSessionCacheSize >= 0 )
      +

      { + context.getClientSessionContext().setSessionCacheSize( clientSessionCacheSize ); + }

      + if( clientSessionTimeout >= 0 )
      +

      { + context.getClientSessionContext().setSessionTimeout( clientSessionTimeout ); + }

      +
      + if( serverSessionCacheSize >= 0 )
      +

      { + context.getServerSessionContext().setSessionCacheSize( serverSessionCacheSize ); + }

      +
      + if( serverSessionTimeout >= 0 )
      +

      { + context.getServerSessionContext().setSessionTimeout( serverSessionTimeout ); + }

      +
      return context;
      }

      @@ -393,5 +417,47 @@
      this.secureRandom = secureRandom;
      }

      + /**
      + * Sets the SSLSession cache size for the

      {@link SSLSessionContext} for use in client mode.
      + *
      + * @param size the new session cache size limit; zero means there is no limit.
      + * @see SSLSessionContext#setSessionCacheSize(int size)
      + */
      + public void setClientSessionCacheSize(int size)
      + { + this.clientSessionCacheSize = size; + }

      + /**
      + * Set the SSLSession timeout limit for the {@link SSLSessionContext}

      for use in client mode.
      + *
      + * @param seconds the new session timeout limit in seconds; zero means there is no limit.
      + * @see SSLSessionContext#setSessionTimeout(int seconds)
      + */
      + public void setClientSessionTimeout(int seconds)
      +

      { + this.clientSessionTimeout = seconds; + }

      +
      + /**
      + * Sets the SSLSession cache size for the

      {@link SSLSessionContext} for use in server mode.
      + *
      + * @param size the new session cache size limit; zero means there is no limit.
      + * @see SSLSessionContext#setSessionCacheSize(int size)
      + */
      + public void setServerSessionCacheSize(int serverSessionCacheSize)
      + { + this.serverSessionCacheSize = serverSessionCacheSize; + }
      +
      + /**
      + * Set the SSLSession timeout limit for the {@link SSLSessionContext}

      for use in server mode.
      + *
      + * @param seconds the new session timeout limit in seconds; zero means there is no limit.
      + * @see SSLSessionContext#setSessionTimeout(int seconds)
      + */
      + public void setServerSessionTimeout(int serverSessionTimeout)
      +

      { + this.serverSessionTimeout = serverSessionTimeout; + }

      }

      Attachments

        Activity

          People

            niklas@trillian.se Niklas Therning
            woltere Wolter Eldering
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: