We've got a JQuery web app and a JAX-RS-based backend running on Wildfly 8.
The application uses Basic authentication with a custom DatabaseServerLoginModule, which in turn implements PBKDF2 for password hashing. Each request is authenticated in this way.
We've discovered that on some browsers and on some occasions (haven't quite figured out which), the 401 returned by Wildfly upon failed authentication triggers the browser's native login popup to show up, rather than to let our JQuery app handle the status code. Needless to say, this doesn't make for a very nice user experience.
I'm looking for a way to avoid this behaviour, and it seems the general solution seems to be either to return a different status code, or to skip the www-authenticate header. The problem is that I can't for the life of me figure out how to customize this behaviour in Wildfly, and in general the whole area seems to be rather poorly documented. Does anyone know of a simple way of doing it? Or any way of doing it? Can you configure Wildfly or override the class (which one?) that returns 401 upon a failed login?
I found this forum post which deals with the same problem, but it uses PicketLink which I haven't been able to get up and running, and either way it doesn't exactly strike me as a "simple" solution for what I would define as a trivial problem.
Any help would be greatly appreciated.