In spring-boot-autoconfigure version 2.0.0.M6, OAuth2ClientPropertiesRegistrationAdapter does not configure ClientRegistration userNameAttributeName field using the provider's custom userNameAttribute.
See attached patch for a fix.
OAuth2ClientPropertiesRegistrationAdapter_userNameAttributeName.patch.txt
For example, if you configure a custom userNameAttribute for the userInfoUri on a provider, like so:
spring.security.oauth2.client.provider.my-provider-identifier.userNameAttribute = id
and then configure a client for that provider like so:
spring.security.oauth2.client.registration.my-client-identifier.provider = my-provider-identifier
OAuth2ClientPropertiesRegistrationAdapter will not configure ClientRegistration.userNameAttributeName with id and instead it will default to name.
This is inconsistent with Spring Boot documentation here:
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/boot-features-security.html