6 Replies Latest reply on Jun 24, 2016 8:16 AM by geturner

    Using HttpHandler class in Undertow

    geturner

      Does anyone have any experience with the HttpHandler class in Undertow.  I need to implement Certificate Revocation, and the only way I can see to do so is with this class.  I have found how the implementations are registered and how the handleRequest method can "reject" or send to the next handler, but I cannot find any documentation on "where" to insert my handler so that I can reject a connection using a revoked certificate.  I created an updated version of SSLHeaderHandler and I cannot get a debug trap to hit OR get any logging that I added to occur.  Any help would be GREATLY APPRECIATED!

        • 1. Re: Using HttpHandler class in Undertow
          jaikiran

          I think you might get this answered in the undertow-dev list which is frequented by undertow developers, if you ask there undertow-dev Info Page

          • 2. Re: Using HttpHandler class in Undertow
            ctomc

            To modify the handler chain of your deployment take you should write ServletExtension  http://undertow.io/undertow-docs/undertow-docs-1.3.0/index.html#servlet-extensions

             

            but for more in depth questions on how to implement specific handlers, I would agree with Jaikiran and point you do undertow-dev mailing list.

            • 3. Re: Using HttpHandler class in Undertow
              geturner

              I don't want a per app solution, I need a per server zolution.  I did find an example of using the handler to setup a filter.  I am chasing that, I will post my solution if it works.

              • 4. Re: Using HttpHandler class in Undertow
                ctomc

                then you need to package your handler(s) into a module, and configure custom-filter in undertow subsystem.

                • 5. Re: Using HttpHandler class in Undertow
                  geturner

                  Exactly what I am doing.  I found what looks like a very good example:

                  https://kb.novaordis.com/index.php/Configuring_a_Custom_Undertow_Filter_in_WildFly

                  • 6. Re: Using HttpHandler class in Undertow
                    geturner

                    I am posting my own solution for others to use.  Here is the implementation of the filter class, with the standalone excerpt and the module definition, enjoy!

                     

                    <subsystem xmlns="urn:jboss:domain:undertow:3.0">

                       <buffer-cache name="default"/>

                       <server name="default-server">

                       <http-listener name="default" max-post-size="9223372036854775807" socket-binding="http" redirect-socket="https"/>

                       <https-listener name="default-https" max-post-size="9223372036854775807"
                       enabled-protocols="TLSv1,TLSv1.1,TLSv1.2" verify-client="REQUIRED" security-realm="ApplicationRealm" socket-binding="https"/>

                       <host name="default-host" alias="localhost">

                       <location name="/" handler="welcome-content"/>

                       <location name="/downloads" handler="download_handler"/>

                       <access-log pattern="%h %l %u [%t] &quot;%r&quot; %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;"/>

                       <filter-ref name="server-header"/>

                       <filter-ref name="x-powered-by-header"/>

                       <filter-ref name="certificaterevocationfilter"/>

                       </host>

                       </server>

                       <servlet-container name="default">

                       <jsp-config/>

                       <websockets/>

                       </servlet-container>

                       <handlers>

                       <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                       <file name="download_handler" directory-listing="true" path="/downloads"/>

                       </handlers>

                       <filters>

                       <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>

                       <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                       <filter name="certificaterevocationfilter" module="com.lmco.spacefence.server"
                       class-name="com.lmco.spacefence.server.certificaterevocation.CertificateRevocationFilter"/>

                       </filters>