简体   繁体   English

Shibboleth IDP定制登录处理程序向IDP错误处理程序抛出错误的最佳方法

[英]Shibboleth IDP custom login handler best way to throw error to the idp error handler

I have shibboleth idp 2.4.0 implementation where I have a custom login handler. 我有shibboleth idp 2.4.0实现,其中有一个自定义登录处理程序。 I have tried throwing ServletException from the custom handler's servlet, but the resulting idp error.jsp is not displaying any specific error messaging. 我曾尝试从自定义处理程序的servlet中抛出ServletException,但是生成的idp error.jsp没有显示任何特定的错误消息。 Is there a specific Exception type I should be throwing from my login handler's servlet? 我应该从登录处理程序的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. 我能够确定Shibboleth IDP error.jsp从请求中的Throwable(如果存在)中获取任何错误消息,作为键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. 因此,在我的Servlet中,我捕获了service方法中的所有异常,自定义一个异常并将其设置为request属性,然后抛出ServletException。 Result. 结果。 My customized error messaging is displayed on the error.jsp. 我的自定义错误消息显示在error.jsp上。

I used the following example in my custom login handler servlet's service() method (sort of): 我在自定义登录处理程序servlet的service()方法(某种)中使用了以下示例:

Throwable myCustomException = new MyServletException("my servlet error messaging");
request.setAttribute(AbstractErrorHandler.ERROR_KEY, myCustomException);
throw new ServletException(myCustomException);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM