NTLMv2 Servlet Filter

This simple servlet filter performs an NTLMv2 authentication with the browser client. After successful authentication, a HTTP session is created and access to the application is granted.

The filter uses EHCache for caching the NTLM challenges. While still pretty basic in its functionality, the filter should be production-ready as it is.

The example web.xml file shows how to enable the filter in your web application, and which configuration settings must be provided:

        <filter>
                <filter-name>ntlmv2-auth</filter-name>
                <filter-class>org.ntlmv2.filter.NtlmFilter</filter-class>
                <init-param>
                        <!-- Windows domain name -->
                        <param-name>ntlm-domain</param-name>
                        <param-value>ACME.CORP</param-value>
                </init-param>
                <init-param>
                        <!-- IP-address of domain controller -->
                        <param-name>ntlm-dc</param-name>
                        <param-value>dcone.acme.com</param-value>
                </init-param>
                <init-param>
                        <!-- Simple (non-FQDN) hostname of DC host -->
                        <param-name>ntlm-dc-name</param-name>
                        <param-value>dcone</param-value>
                </init-param>
                <init-param>
                        <!-- Computer account for connection to DC -->
                        <param-name>ntlm-account</param-name>
                        <param-value>TECHUSER$@ACME.CORP</param-value>
                </init-param>
                <init-param>
                        <!-- Password of computer account -->
                        <param-name>ntlm-password</param-name>
                        <param-value>test1234</param-value>
                </init-param>
        </filter>
        
        <filter-mapping>
                <filter-name>NTLMv2</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>