如何通过调用 Web 服务来覆盖现有的 Spring Security 身份验证,当它失败时,需要重定向一些第三方登录页面。
要调用此身份验证 Web 服务,我需要获取一些 ServletRequest 参数,而对于重定向,我需要访问 ServletResponse。
因此,我需要找出一些带有 ServletRequest 和 ServletResponse 参数的身份验证方法。
但是,我仍然没有找到这样的 ProcessingFilter 或 AuthenticationProvider。
根据 Spring Security basic,似乎我必须覆盖与 AuthenticationProvider 相关的身份验证方法。
根据用例,我必须实现 Spring Security Pre-authentication,
但问题是 PreAuthenticatedAuthenticationProvider 相关的 'authenticate' 方法只有 Authentication 参数。
PreAuthenticatedAuthenticationProvider
public class PreAuthenticatedAuthenticationProvider implements
AuthenticationProvider, InitializingBean, Ordered {
public Authentication authenticate(Authentication authentication) {}
}
作为解决方案,是否有可能使用AuthenticationFailureHandler的自定义实现?
谢谢。