Custom Shield realm (CAS) with Kibana - redirect to login page

I am currently writing a custom realm to implement CAS authentication. The goal is to redirect the user to a login page ( if he doesn't have an authentication token. When catching the missingToken exception, elasticsearch sends a 302 header with location:

This seems to work well. Only problem is that Kibana calls elasticsearch using an AJAX request, therefore the user is not redirected (the error page is shown instead). Is there another way to achieve that or should I modify the Kibana source code?

Any help would be greatly appreciated. Thanks!

Hi Andrei, did you find an answer for your problem?