Весенняя безопасность с Граалями

Я работаю над Spring Security с Grails. В моем сценарии мне нужно создать CustomAuthenticationFilter где мне нужно поступить с некоторой логикой и вызвать поток безопасности весны.

Но я не могу назвать поток безопасности весны из структуры Грааля.

Следующие шаги приведены ниже:

  1. Создано CustomAuthenticationFilter
  2. Создать токен с помощью UsernamePasswordAuthenticationToken и передать AuthenticationManager провайдеру это.token = this.getAuthenticationManager().authenticate(UsernamePasswordAuthenticationToken(username, password,authorities));
  3. Если нет AuthenticationException бросается тогда это означает успех и вернуть объект аутентификации.
  4. Построить и вернуть объект аутентификации (UsernamePasswordAuthenticationToken) к фильтру, который будет помещен в SecurityContextHolder,Code-SecurityContextHolder.getContext().setAuthentication(token);
  5. регистрирующий CustomAuthenticationFilter в BootStrap.groovy SpringSecurityUtils.clientRegisterFilter(customAuthenticationFilter, SecurityFilterPosition.SECURITY_CONTEXT_FILTER.order + 3)
  6. регистрирующий customAuthenticationFilter в resources.groovy customAuthenticationFilter(CustomAuthenticationFilter) { authenticationManager = ref(‘authenticationManager’) }

    Но на шаге 2 я получаю нулевые значения. Я не получаю токен. Я не знаю, где я допустил ошибку.

0 ответов

Другие вопросы по тегам