4

SecurityContextHolder.getContext().getAuthentication() returning null when i call inside a @Async method. Tried to use SecurityContextHolder.MODE_INHERITABLETHREADLOCAL strategy. but it doesn't work

<bean
      class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
      <property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" />
      <property name="targetMethod" value="setStrategyName" />
      <property name="arguments" value="MODE_INHERITABLETHREADLOCAL" />
  </bean>

used inside applicationContext-security.xml and applicationContext.xml as well

M. Deinum
  • 104,041
  • 21
  • 200
  • 207
user3132347
  • 337
  • 7
  • 25

0 Answers0