Servlets Spring Security ApplicationListener<;认证成功事件>;

Servlets Spring Security ApplicationListener<;认证成功事件>;,servlets,spring-security,listener,Servlets,Spring Security,Listener,嗨,我已经实现了一个 ApplicationListener<AuthenticationSuccessEvent> ApplicationListener 当此事件发生时,我想为ServletResponse设置一个cookie 我如何访问它 我应该用过滤器吗?但是筛选器如何对此事件作出反应?请尝试设置AuthenticationSuccessHandler。您将收到HttpServletResponse作为一个参数,因此使用coockies不会有问题。在这里尝试了这一点:它不

嗨,我已经实现了一个

ApplicationListener<AuthenticationSuccessEvent>
ApplicationListener
当此事件发生时,我想为ServletResponse设置一个cookie

我如何访问它


我应该用过滤器吗?但是筛选器如何对此事件作出反应?

请尝试设置
AuthenticationSuccessHandler
。您将收到HttpServletResponse作为一个参数,因此使用coockies不会有问题。

在这里尝试了这一点:它不是通过基本身份验证调用的