How to get javax.servlet.Filter called before Keycloak Authentication
Have you tried to change the order of the elements in the web.xml (eg put filter definitions BEFORE servlet definitions) ?
Not sure it will works, but the doc says: "The order of the filters in the chain is the same as the order that filter mappings appear in the web application deployment descriptor"
The principle may be also true for the order between servlets and filters...
It may be because Tomcat Authentication Valve kick in before Filters. Check Authenticators.properties file. You may need to wrap your filter class as Valve