Атрибут сеанса, установленный в пружинном фильтре, расширяющем AbstractAuthenticationProcessingFilter, недоступный в SimpleUrlAuthenticationSuccessHandler - PullRequest
1 голос
/ 24 октября 2019

Я пытаюсь установить значение в сеансе в пользовательском фильтре 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")

, я получаю ноль.

Как установить значение в сеансе или передать значение из фильтра обработчику.

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...