title: Spring OAuth2 Resource Server - user-name-attribute not reflected in SecurityContextHolder
body: <p>I have a claim named <code>user_name</code> within my JWT and also corresponding <code>user-name-attribute</code> set as <code>user_name</code> in spring security oauth2 client provider proper property:</p>
  
  <p><code>spring.security.oauth2.client.provider.my-oauth-provider.user-name-attribute=user_name</code></p>
  
  <p>I can also see this property is properly being read by <code>ReactiveClientRegistrationRepository</code> class (<code>ClientRegistration.ProviderDetails.UserInfoEndpoint</code>). But when I read <code>SecurityContextHolder.getContext().getAuthentication().getName()</code> <strong>on Resource Server</strong> I can see the value taken from (default) <code>sub</code> - <code>IdTokenClaimNames.SUB</code> claim. </p>
  
  <p>Why is that? Do I still miss some additional configuration also on resource server side to have specified <code>user-name-attribute</code> taken and returned by <code>SecurityContextHolder.getContext().getAuthentication().getName()</code> on Resource Server? I understand that only Bearer token (and maybe some cookies) is being sent from client to resource server so maybe also some other filter is needed on Gateway/client side - just guessing?</p>