Well, I have a tricky question, but hopefully someone can point me to a simple enough direction as Google was not really helpful...
I have the following architecture:
- Server-side: Java Spring MVC server with Tomcat container - FORM authentication (via j_security_check) vs a custom DataSourceRealm, which after successful authentication injects the GenericPrincipal with additional session-specific data (custom Principal class)
- Client-side: Ionic hybrid app with AngularJS 1.5 running in Chrome and on Android 5.0 device
(note: there is a different web-app working with the same server, as well, and operating correctly)
The app runs fine when emulated in Chrome with --disable-web-security, but when it runs on the device itself it fails with very peculiar symptoms:
- j_security_check logs the user correctly and generates a complete and correct Principal object at the end of the authenticate method
- Subsequent requests to the server are routed to the correct Spring controllers, but when inspecting the request object - the Principal object and the the
authTypeparameter of the request are bothnull(contrasted by the correct values of an instance of GenericPrincipal and "FORM", respectively - when requested from browser or the web-app).
Additional info (searched around for a bit...):
- withCredentials=true is set in AngularJS config
- CORS filter is set to the Tomcat provided filter (with permissive settings) and origin is set to
*in client config:<access origin="*"/> - CSP is set to the permissive settings:
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'">and navigation is allowed with permissive configurations:<allow-navigation href="*"/>and cordova-whitelist-plugin is added
Any ideas what may cause the actual login to succeed (so not CORS), content loaded and executed (so not CSP) and requests routed correctly (so not Spring), but nevertheless Tomcat failing to inject the session to the request?