Я пытаюсь установить значение в сеансе в пользовательском фильтре Spring, который расширяет AbstractAuthenticationProcessingFilter.
public class OpenIdConnectFilter extends AbstractAuthenticationProcessingFilter {
public OAuth2RestOperations restTemplate;
public OpenIdConnectFilter(String defaultFilterProcessesUrl) {
super(defaultFilterProcessesUrl);
setAuthenticationManager(new NoopAuthenticationManager());
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
request.getSession().setAttribute("Sample_Attribute", "Hello World");
}
У меня есть класс AuthenticationSuccessHandler (который расширяет SimpleUrlAuthenticationSuccessHandler), где я хочу получить значение атрибута сеанса, но здесь, когда я делаю
request.getSession().getAttribute("Sample_Attribute")
, я получаю ноль.
Как установить значение в сеансе или передать значение из фильтра обработчику.
Спасибо