我们正在使用WSO2 Identity Server 5.8.0。
我们对项目org.wso2.carbon.identity.application.authenticator.samlsso.manager.DefaultSAML2SSOManager
中的identity-outbound-auth-samlsso
进行了扩展
基本上,当我们使用基于SAML身份验证的外部IdP时,需要向SAML响应中添加一些检查。
我们进行了所有检查,所有工作都很好。我们面临一个小问题。在某些情况下,当发生某些访问错误时,我们需要为用户定制错误消息。我看到here我看到可以自定义错误消息,并且可以配置WSO2 IS以便在请求参数中传递错误代码。因此,我想做的就是在发生一个错误时生成自定义错误代码。我尝试了以前的配置,然后在org.wso2.carbon.identity.application.authenticator.samlsso.SAMLSSOAuthenticator
类中执行了以下操作
@Override
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException {
try{
//Original code
} catch (SPIDCheckException spe) {
// whenever the code reaches here the subject identifier will be null. Therefore we can't pass AuthenticatedUser object with the exception.
AuthenticationFailedException afe = new AuthenticationFailedException(spe.getMessage(), spe);
afe.setErrorCode("MY_CUSTOM_ERROR_CODE");
throw afe;
}
}
我期望使用以前的配置,我的自定义cose将在请求参数中进行包装,但事实并非如此。因此,我必须找到一种解决方法;我的解决方案是在响应中添加一个cookie,但我不喜欢它。
是否有可能在查询字符串参数中将自定义错误代码从SAMLSSOAuthenticator
传播到登录错误JSP页面?
我有什么遗漏吗?
谢谢
天使
processAuthenticationResponse
方法的catch块的上方设置。参数将传递到重试页面URL参数。