title: How to get principal in reactive Spring controller, without adding some Principal to the method signature?
body: <p>I have a reactive Spring Boot controller using OAuth2 security via introspection. And if I try something like this in my controller:</p>
  <pre><code>@RequestMapping(value = &quot;/ebox2&quot;,
          produces = {&quot;application/json&quot;},
          method = RequestMethod.GET)
  public Mono&lt;ResponseEntity&lt;Ebox&gt;&gt; getEBoxById2(BearerTokenAuthentication authentication, @AuthenticationPrincipal OAuth2AuthenticatedPrincipal principal,
          Principal user) {
      //Here I can access all the principals in the method params
      return result;
  }
  </code></pre>
  <p>Here I can correctly access the Principal object.</p>
  <p>But my spring controller is implementing a generated interface.
  So I can't add &quot;BearerTokenAuthentication authentication&quot;, or &quot;@AuthenticationPrincipal OAuth2AuthenticatedPrincipal principal&quot; to my controller method signature.</p>
  <p>But I do need to get a hold of the principal somehow, to do a DB lookup based on something inside the principal.</p>
  <p>E.g.</p>
  <pre><code>@Override
  public Mono&lt;ResponseEntity&lt;Ebox&gt;&gt; getEBoxById(ServerWebExchange exchange) {
  
      userRepository.getByPrincipalName(/*here I need a property inside the Principal*/);
  
  }
  </code></pre>
  <p>The repository is blocking (no R2DBC yet). So how can I get the principal in the controller? (e.g. pull it out of the exchange) I tried with blocking, but that doesn't seem to work, as it resolves to null.</p>
  <p>Thanks a lot in advance.</p>
  <p>Kind regards,</p>
  <p>Jochen</p>