I have shibboleth idp 2.4.0 implementation where I have a custom login handler. I have tried throwing ServletException from the custom handler's servlet, but the resulting idp error.jsp is not displaying any specific error messaging. Is there a specific Exception type I should be throwing from my login handler's servlet? Any insight would be helpful, thanks.
I was able to figure out that Shibboleth IDP error.jsp gets any error messaging from a Throwable, if it exists, in the request as an attribute under the key AbstractErrorHandler.ERROR_KEY. So in my servlet, I catch all exceptions in the service method, customize an exception and set it as a request attribute, then throw a ServletException. Result. My customized error messaging is displayed on the error.jsp.
I used the following example in my custom login handler servlet's service() method (sort of):
Throwable myCustomException = new MyServletException("my servlet error messaging");
request.setAttribute(AbstractErrorHandler.ERROR_KEY, myCustomException);
throw new ServletException(myCustomException);