title: Get current logged in user in Spring AOP using Spring Webflux
body: <p>I am using Spring Webflux with Kotlin Coroutine and Spring AOP. I have simple Advice which is like this.</p>
  <pre><code>@Around(&quot;@annotation(LogAccess)&quot;)
  public Object logErrorAccess(ProceedingJoinPoint joinPoint) throws Throwable {
  
      MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
      Method method = methodSignature.getMethod();
      LogAccess logAccess = method.getAnnotation(LogAccess.class);
  
      try {
          var result = joinPoint.proceed();
          // Get the current user and user id and log
          return result;
      } catch (Exception e) {
          // Get the current user and user id and log
          throw e;
      }
  }
  </code></pre>
  <p>I tried to use this.</p>
  <pre><code>ReactiveSecurityContextHolder.getContext().map(ct -&gt; ct.getAuthentication().getPrincipal());
  </code></pre>
  <p>But I am getting <code>null</code>. I am using JWT for Auth, However in my controller I can access that information like this.</p>
  <pre><code>@GetMapping(&quot;/profile&quot;)
  suspend fun profile(authentication: Authentication): Response
  </code></pre>
  <p>Is there any way to get this info in Advice somehow.</p>